Added auto-disconnect feature
This commit is contained in:
12
Music-Bot.py
12
Music-Bot.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user