Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复命令帮助已注册discord.py_Python_Discord_Discord.py - Fatal编程技术网

Python 如何修复命令帮助已注册discord.py

Python 如何修复命令帮助已注册discord.py,python,discord,discord.py,Python,Discord,Discord.py,我试图向我的机器人添加一个帮助命令,但是当我运行代码时,我得到了这个错误 raise discord.ClientException('Command {0.name} is already registered.'.format(command))``` ```discord.errors.ClientException: Command help is already registered. 代码如下: py @bot.command() async def help(ctx):

我试图向我的机器人添加一个帮助命令,但是当我运行代码时,我得到了这个错误

raise discord.ClientException('Command {0.name} is already registered.'.format(command))```
```discord.errors.ClientException: Command help is already registered.
代码如下:

py
@bot.command()
async def help(ctx):
    embedVar = discord.Embed(title="**My Commands**", description="My prefix is %", color=0xffff00)
    embedVar.add_field(name="smile", value="For when your indecisive", inline=False)
    embedVar.add_field(name="frown", value="Feel sad? Check if you can be sad!", inline=False)
    embedVar.add_field(name="live", value="Tough question for an inanimate being but ill do my best", inline=False)
    embedVar.add_field(name="die", value="LMAO", inline=False)
    embedVar.add_field(name="pain", value="pain", inline=False)
    embedVar.add_field(name="profile", value="It\'s yours", inline=False)
    embedVar.add_field(name="promote", value="hehehehe", inline=False)
    await ctx.channel.send(embed=embedVar)

默认情况下,
discord.py
有一个帮助命令,您只需使用
bot.remove_命令将其删除即可

bot.remove_命令(“帮助”)
参考:

    • discord.py
      默认情况下有一个帮助命令,您只需使用
      bot.remove_命令将其删除即可

      bot.remove_命令(“帮助”)
      
      参考:

      您可以使用@ukasz Kwieciński的答案,或者直接删除bot实例中的help命令

      bot = commands.Bot(prefix='x', help_command=None)
      
      参考资料:

      您可以使用@ukasz Kwieciński的答案,或者直接删除bot实例中的help命令

      bot = commands.Bot(prefix='x', help_command=None)
      
      参考资料: