我正试图向我的bot添加一个帮助命令,但当我运行代码时,我遇到了这个错误。
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_command
将其删除
bot.remove_command("help")
参考:
Bot.remove_command
您可以使用@Łukasz Kwieciński的答案,也可以直接删除bot实例中的help命令。
bot = commands.Bot(prefix='x', help_command=None)
参考文献:
- 机器人