MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    能否在自己的插件中重载 /help 指令

    开发交流
    5
    10
    230
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BongoCat
      BongoCat last edited by

      如题,mirai-console中的 /help 指令会输出所有指令提示,能否在自己写的插件中重载这个指令,输出自定义的东西。如果可以的话,要怎么重载

      tsudzuki 1 Reply Last reply Reply Quote 0
      • tsudzuki
        tsudzuki 摸鱼 @BongoCat last edited by

        @bongocat 所以你为什么不自己新建一条指令呢

        1 Reply Last reply Reply Quote 0
        • H
          hundun000 ⭐2021⭐ last edited by

          注释说可以。https://github.com/mamoe/mirai-console/blob/master/backend/mirai-console/src/command/CommandManager.kt#L60-L76

          BongoCat 1 Reply Last reply Reply Quote 0
          • BongoCat
            BongoCat @hundun000 last edited by

            @hundun000 感谢

            1 Reply Last reply Reply Quote 0
            • W
              wuxianggujun last edited by

              大佬,你实现了吗

              BongoCat 1 Reply Last reply Reply Quote 0
              • BongoCat
                BongoCat @wuxianggujun last edited by

                @wuxianggujun 实现了,在主函数中加载命令的时候,加一个参数override就行

                override fun onEnable() {
                    # 你自己的help指令
                    HelpCommand.register(override = true)
                    ...
                }
                
                W 2 Replies Last reply Reply Quote 0
                • W
                  wuxianggujun @BongoCat last edited by

                  @BongoCat 我看了文档,然后光看注释没有看下面的代码,尴尬了

                  1 Reply Last reply Reply Quote 0
                  • W
                    wuxianggujun @BongoCat last edited by

                    @BongoCat 不过,感谢。我已经知道了。并且我重写了

                    1 Reply Last reply Reply Quote 0
                    • Him188
                      Him188 last edited by

                      要修改自己插件的提示?可以在 Command 继承 usage。

                      W 1 Reply Last reply Reply Quote 0
                      • W
                        wuxianggujun @Him188 last edited by

                        @Him188 usage是什么

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact