我已将discord.py 机器人存储库克隆到我的raspberrypi。我无法获得与 Mac 相同的功能。除了音频命令之外的所有内容似乎都正常。是否有一个库需要与 pip 要求分开安装?
pi信息:
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
async def play_audio(self, ctx, clip):
vc = await self.join(ctx)
voice = get(ctx.bot.voice_clients, guild=ctx.guild)
voice.play(discord.FFmpegPCMAudio(f"{os.path.dirname(os.path.abspath(__file__))}/../audio/{clip}.mp3"))
while voice.is_playing():
await asyncio.sleep(1)
await vc.disconnect()
你真的安装了ffmpeg吗?我相信它必须单独安装,如果您知道它已安装,请确保它在您的路径中。来自discord.py 文档:
您的路径环境变量中必须有 ffmpeg 或 avconv 可执行文件才能使其工作。