【问题标题】:How do I edit a Discord bot command's description as shown in the default help command?如何编辑 Discord 机器人命令的描述,如默认帮助命令中所示?
【发布时间】:2018-05-31 06:59:24
【问题描述】:
我正在使用 Python 开发一个 Discord 机器人。当用户在特定命令上调用help 命令时,机器人会发回指定的命令——但没有对该命令的描述(默认帮助命令本身除外)。
例如:
User: e!help question
Bot: e!question [question...]
但help 命令的描述已经定义:
User: e!help help
Bot: e!help [commands...] | Shows this message.
如何编辑命令的描述?
【问题讨论】:
标签:
python-3.x
discord.py
【解决方案1】:
您可以在创建命令时使用brief 和description 为帮助命令添加详细信息。请参阅下面的示例代码。
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')
使用!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.
使用!help foo会显示如下
This is the full description
!foo