MiraiForum

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

    关于消息引用回复

    开发交流
    5
    7
    593
    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.
    • L
      Lappand233 last edited by Lappand233

      萌新第一次写插件,怎么才能实现如图的效果

      globalEventChannel().subscribeAlways<GroupMessageEvent> {
          if (message.content == "test") {
              //TODO 这里该写什么?
          }
      }
      
      1 Reply Last reply Reply Quote 0
      • cssxsh
        cssxsh last edited by cssxsh

        你可以应该用dsl语法

        subscribeMessages {
            "test1" containsReply "Hello World"
        
            "test2" containsReply {
                message.quote() + "Hello World"
            }
        
            contains("test3") reply {
                "Hello World"
            }
        
            contains("test4") quoteReply {
                 "Hello World"
            }
        }
        

        尝试用this. 把可用的dsl方法列出来自己实验,自己多试试才能了解
        21-05-21_idea64_wsyrUgdmsT.png

        L 1 Reply Last reply Reply Quote 0
        • RainChan
          RainChan 摸鱼 last edited by

          使用带有quote字样的方法就行,可以查看源代码中的注释

          不过对于kotlin新手来说不建议使用dsl

          L 1 Reply Last reply Reply Quote 0
          • MrXiaoM
            MrXiaoM 童心未泯 last edited by MrXiaoM

            我在 java 我是这么写的,仅供参考

            QuoteReply quote = new QuoteReply(event.getMessageSource());
            quote.plus("message here");
            // 然后 .sendMessage(quote);
            
            1 Reply Last reply Reply Quote 0
            • yoonching
              yoonching last edited by

              根据你的代码片段,我想可以这样:
              //TODO 这里该写什么?
              subject.sendMessage(message.quote() + "回复内容")

              1 Reply Last reply Reply Quote 0
              • L
                Lappand233 @cssxsh last edited by

                @cssxsh 在 关于消息引用回复 中说:

                你可以应该用dsl语法

                subscribeMessages {
                    "test1" containsReply "Hello World"
                
                    "test2" containsReply {
                        message.quote() + "Hello World"
                    }
                
                    contains("test3") reply {
                        "Hello World"
                    }
                
                    contains("test4") quoteReply {
                         "Hello World"
                    }
                }
                

                尝试用this. 把可用的dsl方法列出来自己实验,自己多试试才能了解
                21-05-21_idea64_wsyrUgdmsT.png

                初学kt,有一定的Java基础,还不懂dsl可以给个Demo参考下吗?谢谢大佬

                1 Reply Last reply Reply Quote 0
                • L
                  Lappand233 @RainChan last edited by

                  @rainchan 在 关于消息引用回复 中说:

                  使用带有quote字样的方法就行,可以查看源代码中的注释

                  不过对于kotlin新手来说不建议使用dsl

                  @mrxiaom 在 关于消息引用回复 中说:

                  我在 java 我是这么写的,仅供参考

                  QuoteReply quote = new QuoteReply(event.getMessageSource());
                  quote.plus("message here");
                  // 然后 .sendMessage(quote);
                  

                  @yoonching 在 关于消息引用回复 中说:

                  根据你的代码片段,我想可以这样:
                  //TODO 这里该写什么?
                  subject.sendMessage(message.quote() + "回复内容")

                  @cssxsh 在 关于消息引用回复 中说:

                  你可以应该用dsl语法

                  subscribeMessages {
                      "test1" containsReply "Hello World"
                  
                      "test2" containsReply {
                          message.quote() + "Hello World"
                      }
                  
                      contains("test3") reply {
                          "Hello World"
                      }
                  
                      contains("test4") quoteReply {
                           "Hello World"
                      }
                  }
                  

                  尝试用this. 把可用的dsl方法列出来自己实验,自己多试试才能了解
                  21-05-21_idea64_wsyrUgdmsT.png

                  谢谢各位大佬的帮助

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