如何在discord.py中使用create_ffmpeg_player

时间:2019-01-11 14:54:52

标签: python subprocess discord.py

我无法在discord.py中使用create_ffmpeg_player()

我正在创建仅在某些语音通道上工作的discord tts bot。 所以我用gTTS制作了mp3文件,效果很好 但是当我通过create_ffmpeg_player()播放mp3文件时,控制台会说找不到文件!

请帮助我

这是我有关create_ffmpeg_player的代码

vc = client.voice_client_in(message.server) 

player = await vc.create_ffmpeg_player('dts.mp3')

player.start()

我用voice_client_in在vc中获取voiceclient

这是我的错误代码

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\discord\voice_client.py", line 431, in create_ffmpeg_player
    p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr)
  File "C:\Program Files\Python36\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Program Files\Python36\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 지정된 파일을 찾을 수 없습니다/*(The specified file could not be found.)*/

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "dts.py", line 76, in on_message
    player = await vc.create_ffmpeg_player('dts.mp3')
  File "C:\Program Files\Python36\lib\site-packages\discord\voice_client.py", line 434, in create_ffmpeg_player
    raise ClientException('ffmpeg/avconv was not found in your PATH environment variable') from e
discord.errors.ClientException: ffmpeg/avconv was not found in your PATH environment variable

如果运行良好,必须播放语音mp3文件! 但这只会发生错误

错误说找不到文件,但是.py文件所在的目录中有一个mp3文件。

请帮助我制作我的机器人

0 个答案:

没有答案