sync def play_next(inter) -> coroutines: # Если бот в голосовом канале
try:
voice = inter.bot.voice_clients[0]
song = queue[inter.guild.id].pop(0)
if song is None:
queue.clear()
await voice.disconnect()
else:
with YoutubeDL(YDL_OPTIONS) as ydl:
if 'https://' in song:
info = ydl.extract_info(song, download=False)
link = info['formats'][0]['url']
voice.play(
disnake.FFmpegPCMAudio(executable='data_files/ffmpeg.exe', source=link, **FFMPEG_OPTIONS),
after=lambda e: run(play_next(inter)))
else:
info = ydl.extract_info(f'ytsearch:{song}', download=False)['entries'][0]
link = info['formats'][0]['url']
voice.play(
disnake.FFmpegPCMAudio(executable='data_files/ffmpeg.exe', source=link, **FFMPEG_OPTIONS),
after=lambda e: run(play_next(inter)))
except:
voice = inter.bot.voice_clients[0]
asyncio.run_coroutine_threadsafe(leave(inter), bot.loop)
sudo apt install ffmpeg
whereis ffmpeg
ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz
dpkg -L ffmpeg
...
/usr/bin/ffmpeg
/usr/bin/ffplay
/usr/bin/ffprobe
...
/usr/local/bin/
или /usr/local/sbin/
например.