MiraiForum

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

    关于At API方面的问题

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

      假如有个新成员进群。
      我这边机器人就@新成员。

      看了一下API文档还不是很能理解。

      能否给个大致的实例代码我理解一下At这个API该如何运用?

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

        At 属于一个消息元素类型, 里面包含 @ 的对象的 id, 如果需要 @ 某一个人,在发送的信息体加上 At 元素即可

        listenMemberJoinEvent { // this: MemberJoinEvent
            group.sendMessage(At(member.id) + PlainText(" hello!"))
        }
        
        Oeed 1 Reply Last reply Reply Quote 0
        • Karlatemp
          Karlatemp last edited by

          https://docs.mirai.mamoe.net/Messages.html

          1 Reply Last reply Reply Quote 0
          • Oeed
            Oeed @Karlatemp last edited by

            @karlatemp
            十分感谢解答。
            因为是刚刚开始学习这个语言,对于类型之类的东西不太熟悉。

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