This commit is contained in:
+3
-2
@@ -20,6 +20,7 @@ async def play(ctx, *, url: str):
|
|||||||
if voice_state is None or voice_state.channel_id is None:
|
if voice_state is None or voice_state.channel_id is None:
|
||||||
await ctx.reply("You're not in a voice channel!")
|
await ctx.reply("You're not in a voice channel!")
|
||||||
return
|
return
|
||||||
|
channel = await _bot.fetch_channel(str(voice_state.channel_id))
|
||||||
logging.info(f"Playing {url}")
|
logging.info(f"Playing {url}")
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'format': 'm4a/bestaudio/best',
|
'format': 'm4a/bestaudio/best',
|
||||||
@@ -36,7 +37,7 @@ async def play(ctx, *, url: str):
|
|||||||
title = info.get('title', 'Unknown Title')
|
title = info.get('title', 'Unknown Title')
|
||||||
logging.info(f"Downloaded to {filename}")
|
logging.info(f"Downloaded to {filename}")
|
||||||
|
|
||||||
ctx.send(f"Playing {title} in {voice_state.channel.mention}")
|
await ctx.reply(f"Playing {title} in {channel.mention}")
|
||||||
|
|
||||||
async with await voice_state.channel.connect(_bot) as vc:
|
async with await channel.connect(_bot) as vc:
|
||||||
await vc.play_file(filename)
|
await vc.play_file(filename)
|
||||||
|
|||||||
Reference in New Issue
Block a user