MiraiForum

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

    请教一个关于JCompositeCommand的问题

    开发交流
    2
    4
    346
    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.
    • rong_xiaoli
      rong_xiaoli last edited by

      已知子命令由@SubCommand标识,我希望主命令也可以被单独处理。举个例子:

      User: /CompositeCommand
      Bot: CompositeCommand main command invoked. 
      User: /CompositeCommand subcommand01
      Bot: CompositeCommand subcommand 1 invoked. 
      

      类似于这种的。我有一个复杂的命令,最好需要把主命令拆出来当成帮助命令使用。有无大佬提点迷津,谢谢。

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

        处理复杂的指令建议监听消息并自行处理指令事件

                GlobalEventChannel.INSTANCE.subscribeAlways(GroupMessageEvent.class, e -> {
                    var str = e.getMessage().contentToString();
                    if (str.startsWith("/command")) {
                        // ...
                    }
                });
        
        1 Reply Last reply Reply Quote 1
        • rong_xiaoli
          rong_xiaoli last edited by

          我在想有没有必要把它作为一个想法提交Issue(

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

            佬们怎么都这么强,我都不敢把我的插件贴出来了(

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