[英]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.