From daaa120594a1daa8b5bc7eacb4431de216a45748 Mon Sep 17 00:00:00 2001 From: Lukas Blacha Date: Wed, 8 Feb 2023 18:52:58 +0100 Subject: [PATCH] Added auto-disconnect feature --- Music-Bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Music-Bot.py b/Music-Bot.py index b8a7e89..293e396 100644 --- a/Music-Bot.py +++ b/Music-Bot.py @@ -204,7 +204,10 @@ else: player, after=lambda e: print(f"Player error: {e}") if e else None ) await ctx.respond(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}") - await ctx.voice_client.disconnect() + while ctx.voice_client.is_playing(): + asyncio.sleep(1) + else: + ctx.voice_client.disconnect() @bot.slash_command(name="pause", description="Pauses the playback")