Python Discord.py音乐bot无法正常工作并产生错误

Python Discord.py音乐bot无法正常工作并产生错误,python,discord.py,discord.py-rewrite,Python,Discord.py,Discord.py Rewrite,你好,我正在尝试为我的discord服务器创建一个音乐机器人。然而,当我尝试播放音乐时,错误是 query "song: Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest v

你好,我正在尝试为我的discord服务器创建一个音乐机器人。然而,当我尝试播放音乐时,错误是

query "song: Failed to parse JSON  (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
代码如下:

@commands.command()
    async def play(self, ctx: commands.Context, url: str, *args: str):
        

        music_queue = self.music_queues[ctx.guild]
        voice = get(self.bot.voice_clients, guild=ctx.guild)

        try:
            channel = ctx.message.author.voice.channel
        except:
            await ctx.send('You\'re not connected to a voice channel.')
            return

        if voice is not None and not self.client_in_same_channel(ctx.message.author, ctx.guild):
            await ctx.send('You\'re not in my voice channel.')
            return

        if not url.startswith('https://'):
            url = f'ytsearch1:{url} {" ".join(args)}'

        try:
            song = Song(url, author=ctx.author)
        except SongRequestError as e:
            await ctx.send(e.args[0])
            return

        music_queue.append(song)
        await ctx.send(f'Queued song: {song.title}')

        if voice is None or not voice.is_connected():
            await channel.connect()

        await self.play_all_songs(ctx.guild)
它以前工作正常,我不知道应该把冗长的内容放在哪里。Youtube dl已更新,我已安装所有软件包。我正在使用repl.it编辑代码


非常感谢您的帮助。

我对Python不是很有经验,但作为建议,您是否确保JSON文件在文件开头正确引用(链接或任何名称)作为源文件,并且JSON被正确导入和写入?您的代码似乎无法读取包含信息的JSON文件,因此您可能希望使用简单的youtube教程再次检查您的所有代码是否正确写入该文件,因为它们非常有用;即使是有经验的程序员。
更新您的discord.py也可能会有所帮助,因为这可能会变得过时,请记住,某些可能在discord.py的早期版本中工作的命令在较新版本中可能无法工作。

实际上,它在错误消息中表示这是一个bug,因此您可能需要等待,直到他们修复它。请确保您使用的是最新版本。它在两天前就已经运行了,并且在没有JSON文件的情况下运行良好。