将Discord bot的默认帮助命令放入类别(Python)

2024-06-07 21:51:33 发布

您现在位置:Python中文网/ 问答频道 /正文

当我使用默认的help命令时,它明确地显示了我的所有命令,除了No Category下的help命令。我怎么把这个加到齿轮上?在


Tags: no命令help齿轮category
1条回答
网友
1楼 · 发布于 2024-06-07 21:51:33

这可能不是最好的解决方案,但是您可以删除'help'命令,然后在您的cog中重新添加'help'命令,因为不和.py不允许您更改命令的cog_name。默认的帮助命令存储在commands.bot._default_help_command。在

from discord.ext import commands

bot = commands.Bot('.')
bot.remove_command('help')


class ACog:
    @commands.command(pass_context=True)
    async def help(self, ctx, *args: str):
        """Shows this message."""
        return await commands.bot._default_help_command(ctx, *args)


bot.add_cog(ACog())

bot.run('TKOEN')

相关问题 更多 >

    热门问题