1

Сам код:

channel = None
            for q in msg.guild.voice_channels:
                print("Name: {}".format(q.name))
                if(q.name == 'bot-voice'):
                    channel = q
                    break
            
            if channel is None:
                await msg.channel.send("**Channel not founded!**", delete_after = 2)
            else:
                
                await channel.connect(timeout=60.0, reconnect=True)
                await msg.guild.voice_client.play(discord.FFmpegPCMAudio("test_voice.mp3"), after=lambda e: print("Song done!"))
                t.sleep(5)
                await msg.guild.voice_client.disconnect()

Лог ошибки:

Ignoring exception in on_message
Traceback (most recent call last):
  File "d:\work\Ihate\IhateInternet\env\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "d:\work\Ihate\IhateInternet\IhateInternet.py", line 261, in on_message
    await msg.guild.voice_client.play(discord.FFmpegPCMAudio("test_voice.mp3"), after=lambda e: print("Song done!"))
  File "d:\work\Ihate\IhateInternet\env\lib\site-packages\discord\player.py", line 225, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "d:\work\Ihate\IhateInternet\env\lib\site-packages\discord\player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "d:\work\Ihate\IhateInternet\env\lib\site-packages\discord\player.py", line 147, in _spawn_process
    raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.

1 ответ 1

0

Для того что бы использовать FFmpegPCMAudio нужно скачать его с официального сайта https://ffmpeg.org/download.html.

Это должно выглядеть так:

source = discord.FFmpegPCMAudio(executable="ffmpeg executable path", source=src)
voice_client.play(source)

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.