Added auto-disconnect feature

This commit is contained in:
Lukas Blacha
2023-02-08 18:57:57 +01:00
parent cde8430d53
commit 67cb769111

View File

@@ -195,7 +195,7 @@ else:
finally:
await ctx.send(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}")
while ctx.voice_client.is_playing():
asyncio.sleep(3)
await asyncio.sleep(3)
else:
await ctx.voice_client.disconnect()
@@ -208,9 +208,8 @@ 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}")
print(dir(ctx.voice_client))
while ctx.voice_client.is_playing():
asyncio.sleep(3)
await asyncio.sleep(3)
else:
await ctx.voice_client.disconnect()
@@ -256,7 +255,7 @@ else:
finally:
await ctx.send(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}")
while ctx.voice_client.is_playing():
asyncio.sleep(3)
await asyncio.sleep(3)
else:
await ctx.voice_client.disconnect()
@@ -274,11 +273,6 @@ else:
ctx.voice_client.stop()
@bot.event
async def on_voice_state_update(ctx: commands.Context):
ctx.voice_client.disconnect()
@bot.event