Added auto-disconnect feature

This commit is contained in:
Lukas Blacha
2023-02-08 18:38:21 +01:00
parent 26a2d07714
commit 8ff36532cc

View File

@@ -203,7 +203,9 @@ else:
ctx.voice_client.play(
player, after=lambda e: print(f"Player error: {e}") if e else None
)
while ctx.is_playing():
await asyncio.sleep(1)
await ctx.disconnect()
await ctx.respond(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}")
@@ -261,15 +263,6 @@ else:
elif ctx.voice_client.is_playing():
ctx.voice_client.stop()
@bot.event
async def on_voice_state_update(ctx: commands.Context):
while True:
await asyncio.sleep(1)
if ctx.voice_client.is_playing() and not ctx.voice_client.is_paused():
pass
else:
await ctx.voice_client.disconnect()