Added auto-disconnect feature

This commit is contained in:
Lukas Blacha
2023-02-08 18:55:59 +01:00
parent 07ca78e1bc
commit cde8430d53

View File

@@ -194,6 +194,10 @@ else:
raise commands.CommandError(err)
finally:
await ctx.send(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}")
while ctx.voice_client.is_playing():
asyncio.sleep(3)
else:
await ctx.voice_client.disconnect()
@bot.slash_command(name="stream", description="Streams a song from YouTube [Without preloading]")
@@ -206,7 +210,7 @@ else:
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(1)
asyncio.sleep(3)
else:
await ctx.voice_client.disconnect()
@@ -251,6 +255,10 @@ else:
raise commands.CommandError(err)
finally:
await ctx.send(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}")
while ctx.voice_client.is_playing():
asyncio.sleep(3)
else:
await ctx.voice_client.disconnect()
@play.before_invoke