@Bot.command()
async def play(ctx, url):
try:
await ctx.message.author.voice.channel.connect(reconnect=True)
await ctx.send("Подождите немного")
voice = get(Bot.voice_clients, guild=ctx.guild)
with YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(url, download=False)
URL = info['formats'][0]['url']
voice.play(discord.FFmpegPCMAudio(executable="C:\\Windows\\System32\\ffmpeg.exe", source = URL, **FFMPEG_OPTIONS))
voice.is_playing()
except:
voice = get(Bot.voice_clients, guild=ctx.guild)
with YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(url, download=False)
URL = info['formats'][0]['url']
voice.play(discord.FFmpegPCMAudio(executable="C:\\Windows\\System32\\ffmpeg.exe", source = URL, **FFMPEG_OPTIONS))
voice.is_playing()