创建帮助命令的更好方法是使用组。
首先删除默认命令;
client.remove_command("help")
然后使用此方法发出帮助命令:
@client.group(invoke_without_command= True)
async def help(ctx):
# insert your help command embed or message here
embed= discord.Embed(title="Help", description="List of commands")
embed.add_field(name="Moderation", value="!help moderation")
embed.add_field(name="Misc", value="!help misc")
await ctx.send(embed=embed)
您已经完成了帮助命令,现在您必须为某个类别或命令提供帮助。你可以这样做:
@help.command()
async def moderation(ctx):
embed= discord.Embed(title="Moderation", description="List of Moderation commands")
embed.add_field(name="Commands", value="ban, kick, warn, mute, unban")
await ctx.send(embed=embed)
现在如果用户输入,!help moderation 上面的嵌入/消息将被发送。