Проблемы с Музыкальным ботов Discord
возникла такая проблема, музыкальный бот по вызову команды с названием песни заходит в голосовой канал, но не может начать воспроизводить песню, все перепробывал, переустанавливал библиотеки, пробывал устанавливать ffmpeg но без результатно, выдает ошибку что ffmpeg не найден
Ошибка:
ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "/home/runner/PurpleMuffledHack/venv/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "main.py", line 44, in on_message
source = (discord.FFmpegPCMAudio(url))
File "/home/runner/PurpleMuffledHack/venv/lib/python3.10/site-packages/discord/player.py", line 289, in __init__
super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
File "/home/runner/PurpleMuffledHack/venv/lib/python3.10/site-packages/discord/player.py", line 166, in __init__
self._process = self._spawn_process(args, **kwargs)
File "/home/runner/PurpleMuffledHack/venv/lib/python3.10/site-packages/discord/player.py", line 183, in _spawn_process
raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.
Сам код
intents = discord.Intents.all()
client = discord.Client(intents=intents)
ytdl = yt_dlp.YoutubeDL({'format': 'bestaudio', 'noplaylist': 'True'})
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!play'):
query = message.content[6:]
with ytdl:
result = ytdl.extract_info(f"ytsearch:{query}", download=False)
if 'entries' in result:
# take first item from a playlist
video = result['entries'][0]
else:
# take the only video
video = result
url = video['url']
voice_channel = message.author.voice.channel
await voice_channel.connect()
voice_client = message.guild.voice_client
source = (discord.FFmpegPCMAudio(url))
voice_client.play(source)
await message.channel.send(f'Now playing: {video["title"]}')
if message.content.startswith('!stop'):
voice_client = message.guild.voice_client
await voice_client.disconnect()
await message.channel.send('Stopped playing')