我希望设置我的!help命令,以便它显示用户命令、mod命令、管理命令,最后显示我的命令。但是,通过使用cogs将它们分类,它们是按字母顺序加载的,这导致admin是第一个看到的,因为它以A开头。
这是为了我的不和谐机器人,马克西姆斯。我已经尝试更改了bot.load_extension的顺序。然而,这并没有改变类别。这是!help命令:
    Admins:
      purge     Deletes a specific amount of messages
    Members:
      hello     Max says hello!
      joined    Max will tell you when you joined the server!
      report    
      rndatk    Max will pick some attacking ops for you
      rnddef    Max will pick some defending ops for you
      say       Max says what you say!
      version   
    Mods:
      mute      
    Owner:
      logout     
    Type !help command for more info on a command.
    You can also type !help category for more info on a category.我希望它的显示顺序是Members,Mods,Admin,最后是Owner;Members在顶部,Owner在底部。
编辑:
下面是加载4个独立齿轮的4个bot.load_extension。每一个对应于!help中的一个类别:
bot.load_extension("cogs.Users")
bot.load_extension("cogs.Admin")
bot.load_extension("cogs.Mods")
bot.load_extension("cogs.Owner")发布于 2019-02-04 17:36:40
这是一个built-in part of the default help formatter。
要更改此行为,您必须子类化HelpFormatter,覆盖format(),并在初始化formatter时指定子类的一个实例作为Bot。
https://stackoverflow.com/questions/54269713
复制相似问题