MiraiForum

    • 注册
    • 登录
    • 搜索
    • 热门
    • 最新
    • 未解决
    • 标签
    • 群组
    • 友情链接

    关于消息引用回复

    开发交流
    5
    7
    585
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • L
      Lappand233 最后由 Lappand233 编辑

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

      globalEventChannel().subscribeAlways<GroupMessageEvent> {
          if (message.content == "test") {
              //TODO 这里该写什么?
          }
      }
      
      1 条回复 最后回复 回复 引用 0
      • cssxsh
        cssxsh 最后由 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 条回复 最后回复 回复 引用 0
        • RainChan
          RainChan 摸鱼 最后由 编辑

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

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

          L 1 条回复 最后回复 回复 引用 0
          • MrXiaoM
            MrXiaoM 童心未泯 最后由 MrXiaoM 编辑

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

            QuoteReply quote = new QuoteReply(event.getMessageSource());
            quote.plus("message here");
            // 然后 .sendMessage(quote);
            
            1 条回复 最后回复 回复 引用 0
            • yoonching
              yoonching 最后由 编辑

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

              1 条回复 最后回复 回复 引用 0
              • L
                Lappand233 @cssxsh 最后由 编辑

                @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 条回复 最后回复 回复 引用 0
                • L
                  Lappand233 @RainChan 最后由 编辑

                  @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 条回复 最后回复 回复 引用 0
                  • 1 / 1
                  • First post
                    Last post
                  Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact