如何编辑默认帮助命令中显示的 Discord bot 命令的描述?

5 python-3.x discord.py

我正在用 Python 开发一个 Discord 机器人。当用户help在特定命令上调用命令时,机器人会发回指定的命令——但没有对该命令的描述(默认帮助命令本身除外)。

例如:

User: e!help question
Bot: e!question [question...]
Run Code Online (Sandbox Code Playgroud)

但是help命令的描述已经定义:

User: e!help help
Bot: e!help [commands...] | Shows this message.
Run Code Online (Sandbox Code Playgroud)

我将如何编辑命令的描述?

Ben*_*jin 7

您可以在创建命令时使用briefdescription向帮助命令添加详细信息。请参阅下面的示例代码。

from discord.ext import commands

bot_prefix = '!'

client = commands.Bot(command_prefix=bot_prefix)

@client.command(brief='This is the brief description', description='This is the full description')
async def foo():
    await client.say('bar')

client.run('TOKEN')
Run Code Online (Sandbox Code Playgroud)

使用!help会显示如下

?No Category:
  help Shows this message.
  foo  This is the brief description

Type !help command for more info on a command.
You can also type !help category for more info on a category.
Run Code Online (Sandbox Code Playgroud)

使用!help foo会显示如下

This is the full description

!foo
Run Code Online (Sandbox Code Playgroud)