我正在使用 this 制作音乐命令.每当我播放命令时,我都会得到 {query}: No such file or directory。
如果你想看看我的代码:https://pastebin.com/ejR3qPVZ
@commands.command()
async def play(self, ctx, *, query):
"""Plays a file from the local filesystem"""
source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query))
ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None)
await ctx.send('Now playing: {}'.format(query))
我以前有效的代码:https://pastebin.com/SQFzbSmK
最佳答案
使用命令时,您需要传递以 .mp3 结尾的直接链接:!play https://examplesong.mp3
@commands.command()
async def play(self, ctx, *, query):
"""Plays a file from the local filesystem"""
source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query))
ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None)
await ctx.send('Now playing: {}'.format(query))
关于ffmpeg - 没有这样的文件或目录 discord.py,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63831238/