获取所有机器人命令 discord.py

Get all bot commands discord.py

我正在使用 discord.py rewrite 制作一个帮助命令,我需要一种方法来遍历机器人中已有的所有命令,有没有办法像 bot.get_all_commands 那样做?

for command in bot.get_all_commands:
    print(command)

bot.commands returns all commands as command objects in a set.

您可以使用 bot.all_commands to return all commands & aliases that you used before, See more in discord.ext.command .

这对我有用

commands = bot.get_my_commands()
for command in commands:
    print(command)