MiraiForum

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

    message serializeToMiraiCode 不统一

    HTTP API和第三方SDK
    4
    10
    161
    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.
    • Z
      zwangsheng last edited by

      想询问相关的MiraiCode优化,不同类型的message serializeToMiraiCode不同,会不会不太友好。
      比如 at事件 serializeToMiraiCode 是[mirai:at:XXXX]
      而普通的消息事件是纯文本,并不是按照[mirai:type:data]这样子的格式,是否在此处可以进行一步统一。

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

        请给出具体的例子

        而普通的消息事件是纯文本,并不是按照[mirai:type:data]这样子的格式,是否在此处可以进行一步统一。

        请具体描述

        1 Reply Last reply Reply Quote 0
        • Z
          zwangsheng last edited by

          普通消息
          serializeToMiraiCode 后 ?
          AT消息
          serializeToMiraiCode 后 [mirai:at:xxxxxxx]

          1 Reply Last reply Reply Quote 0
          • Z
            zwangsheng last edited by

            如果serializeToMiraiCode之后的MiraiCode无论什么种类都应该遵循[mirai:type:data]这样子的规则

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

              你是指plainText应该一并在serializeToMiraiCode输出成[mirai:plain:data]这种吧
              但是miraiCode就是指miraiCode,然后纯文本就直接输出,在我看来比较正常吧(
              可能你想要的是MessageChain serializeToString ?

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

                我记得很久之前 PlainText 序列化后确实是 [mirai:type:data] 这样的,后来改到纯文本的。
                不清楚为啥要改了,但是改了肯定有改的道理/

                1 Reply Last reply Reply Quote 0
                • Z
                  zwangsheng last edited by

                  emmmmmm这种也可以接受。之前的想法是无论什么message都先serializeToMiraiCode判断类型再做操作

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

                    @zwangsheng 判断类型可以循环MessageChain的每一个singleMessage里再用is判断类型吧

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

                      纯文本直接显示是符合一般信息体的表示方法的, 与 H5 一样, 不需要标识的纯文本并无再套一层 [mirai:plain] 的必要性

                      1 Reply Last reply Reply Quote 0
                      • Z
                        zwangsheng last edited by

                        嗯嗯,我再去研究看看,感谢解答

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