我让所有命令都能正常工作,但我不知道如何对它们进行排序:
Images:
avatar <user> > get someones avatar
etc.
Text:
clap <text> > generate text with clapping emojis
etc.
这是我现在拥有的:
@bot.command(usage="test [command]", description="get help")
async def test2(ctx, args=None):
dude = ''
if args is None:
for i,x in enumerate(bot.commands):
dude += (f'{PREFIX}{x.usage} » {x.description}\n')
await ctx.send(f'```{dude}```')
我尝试将它们分组,但后来意识到我必须将它们与图像头像 @peter 一起使用
答案 0 :(得分:0)
我最终通过使用 brief='x_command' 作为识别命令类别的东西来解决问题
@bot.command(usage="test [command]", description="get help")
async def test2(ctx, args=None):
dude = ''
if args is None:
for i,x in enumerate(bot.commands):
if x.brief == 'image_command':
dude += (f'{PREFIX}{x.usage} » {x.description}\n')
await ctx.send(f'```{dude}```')
所以命令看起来像这样
@bot.command(brief='image_command',usage="avatar <user>", description="send users avatar to chat")
async def avatar(icy, user:discord.User):
await icy.message.delete()
await icy.send(user.avatar_url)