[英]Get description of all slash commands pycord
嘿,所以我现在正在尝试设置动态帮助命令
async def help(self, ctx):
em = discord.Embed(
title='Commands',
description='Shows all commands'
)
commands = ctx.bot.walk_application_commands()
for command in commands:
em.add_field(name = command, value='')
await ctx.respond(embed=em)
但我希望值是命令描述,但我想知道如何获取它
经过一些帮助后,我发现了如何为任何想知道的人做这件事
em = discord.Embed(
title='Commands',
description='Shows all commands'
)
commands = ctx.bot.walk_application_commands()
for command in commands:
description = getattr(command, 'description')
em.add_field(name = command, value=description)
await ctx.respond(embed=em)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.