Added auto-disconnect feature
This commit is contained in:
@@ -188,7 +188,7 @@ else:
|
|||||||
try:
|
try:
|
||||||
player = await YTDLSource.from_url(url, loop=bot.loop)
|
player = await YTDLSource.from_url(url, loop=bot.loop)
|
||||||
ctx.voice_client.play(
|
ctx.voice_client.play(
|
||||||
player, after=await ctx.voice.disconnect())
|
player, after=await ctx.voice_client.disconnect())
|
||||||
except discord.HTTPException as err:
|
except discord.HTTPException as err:
|
||||||
raise commands.CommandError(err)
|
raise commands.CommandError(err)
|
||||||
finally:
|
finally:
|
||||||
@@ -200,7 +200,7 @@ else:
|
|||||||
async with ctx.typing():
|
async with ctx.typing():
|
||||||
player = await YTDLSource.from_url(url, loop=bot.loop, stream=True)
|
player = await YTDLSource.from_url(url, loop=bot.loop, stream=True)
|
||||||
ctx.voice_client.play(
|
ctx.voice_client.play(
|
||||||
player, after=await ctx.voice.disconnect())
|
player, after=await ctx.voice_client.disconnect())
|
||||||
|
|
||||||
await ctx.respond(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}")
|
await ctx.respond(f"{success}Now playing: `{player.title}`\nRequested by {ctx.author.mention}")
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ else:
|
|||||||
try:
|
try:
|
||||||
player = await YTDLSource.from_url(url, loop=bot.loop)
|
player = await YTDLSource.from_url(url, loop=bot.loop)
|
||||||
ctx.voice_client.play(
|
ctx.voice_client.play(
|
||||||
player, after=await ctx.voice.disconnect())
|
player, after=await ctx.voice_client.disconnect())
|
||||||
except discord.HTTPException as err:
|
except discord.HTTPException as err:
|
||||||
raise commands.CommandError(err)
|
raise commands.CommandError(err)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user