From 94d018246c01483e71d0e5497743d6692010c3e0 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 26 Sep 2021 01:51:59 +0200 Subject: [PATCH] Skip song if voice_client is None --- src/bot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bot.py b/src/bot.py index 0d2cde4..df7e1d2 100644 --- a/src/bot.py +++ b/src/bot.py @@ -60,6 +60,13 @@ class Music(commands.Cog): try: await self._queue_lock.acquire() ctx, song = await self._queue.get() + if ctx.voice_client is None: + # Bot is no longer in a voice channel. + # This could be the case because a stop command was issued. + # We will skip this (and possibly all remaining songs) in the queue + self._queue.task_done() + self._queue_lock.release() + continue audio = discord.FFmpegPCMAudio(song.audio_url, **self._ffmpeg_options) def after(err):