MiraiForum

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

    Mirai-Http-Api-JavaSDK

    其他项目发布
    2
    3
    244
    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.
    • X
      xbaimiao last edited by xbaimiao

      此项目基于mirai-http-api
      请启用ws功能

      开源地址:https://github.com/xbaimiao/mirai-http-sdk

      fun main() {
          val wsInfo = WsInfo("http://127.0.0.1:8099/", 2157207381, "INITKEYCgTu5Bcx")
          bot = WebSocketBot(wsInfo).connect()
          bot.join()
          bot.eventChancel.subscribe<GroupMessageEvent> {
              val msg = message.contentToString()
              var boolean1 = false
              for (baseComponent in this.message.toList()) {
                  if (baseComponent is PlainText) {
                      if (baseComponent.string == "禁言") {
                          boolean1 = true
                      }
                  }
              }
              for (baseComponent in this.message.toList()) {
                  if (baseComponent is At) {
                      if (boolean1) {
                          group.getMember(baseComponent.target).thenAccept {
                              it!!.mute(600)
                          }
                      }
                  }
              }
              if (msg == "回复我") {
                  group.quoteMessage(Component.text("好"), "${this.messageSource.messageId}")
              }
          }
      }
      
      1 Reply Last reply Reply Quote 0
      • tsudzuki
        tsudzuki 摸鱼 last edited by

        通过kotlin使用http api调用…kotlin

        X 1 Reply Last reply Reply Quote 0
        • X
          xbaimiao @tsudzuki last edited by

          @tsudzuki
          有没有一种可能我机器人和需要使用机器人的项目不在同一个地方

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