我正在使用this发出音乐命令。每当我执行命令时,我都会得到{query}:没有这样的文件或目录。
如果您想看一下我的代码: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
答案 0 :(得分:0)
使用命令时,您需要传递以.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))