ffmpeg - 没有这样的文件或目录 discord.py

标签 ffmpeg discord.py

我正在使用 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/

相关文章:

python - 为什么 ffmpeg 警告 "Guessed Channel Layout for Input Stream #0.0 : mono"?

powershell - FFMPEG 插值视频 |第一帧卡住,没有对第二帧进行任何插值

FFMPEG - 我如何获得这些重叠视频的边界

python - 导入错误: cannot import name 'Deque'

discord.py - 如何检查机器人是否连接到 channel ? |不和谐.py

python - Discord.py 消息固定?

go - libswscale bad dst 图像指针 cgo

ajax - 使用 Coldfusion 的 CFFILE 标签监控来自 FFMpeg 的进度日志

python - discord.py bot 看不到成员

python - 类型错误 : Inheritance a class from URL is forbidden