MiraiForum

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

    萌新解难

    使用交流
    3
    3
    144
    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.
    • 1
      1asy last edited by

      如何判断是否at自己了

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

        1. 用类型判断,比如 if(At in MessageChain) (可能拼错了,大概这个意思
        2. 用miraicode判断,比如 MeessageChain.toMiraiCode.contain(/*botAt*/) botAt大概是[mirai:at:/*botid*/]
        1 Reply Last reply Reply Quote 1
        • Karlatemp
          Karlatemp last edited by

          if (message.any { it is At && it.target == bot.id }) {}
          if (message.stream().anyMatch( it -> it instanceof At && ((At) it).getTarget() == bot.getId() )) {}
          
          1 Reply Last reply Reply Quote 1
          • 1 / 1
          • First post
            Last post
          Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact