【发布时间】:2021-07-11 12:44:42
【问题描述】:
所以我想在我的不和谐语音频道中播放本地文件,现在它加入了语音频道,但它不播放任何东西。这是代码:
if message.content.startswith('$Hest'):
where = message.content.split(" ")[1]
channel = get(message.guild.channels, name=where)
voicechannel = await channel.connect()
voicechannel.play(discord.FFempegPCMAudio(executable='D:/ffmpeg/ffmpeg/bin/ffplay.exe', source='D:/ffmpeg/Horse.mp3'))
当我尝试这样做时,这是我的输出
Traceback (most recent call last):
File "F:\Apanda\CustomMultiPyBot\venv\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "F:/Apanda/CustomMultiPyBot/main.py", line 41, in on_message
voicechannel.play(discord.FFempegPCMAudio(executable='D:/ffmpeg/ffmpeg/bin/ffplay.exe', source='D:/ffmpeg/Horse.mp3'))
AttributeError: module 'discord' has no attribute 'FFempegPCMAudio'
【问题讨论】:
-
请注意:我建议使用
discord.ext.commandsframework 而不是message.content.startswith(),因为这通常是更好的做法。 -
感谢您的建议 :)
标签: python discord discord.py