Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OfflineMessageSource 回复错误 #2501

Closed
ReanRelay opened this issue Feb 15, 2023 · 1 comment
Closed

OfflineMessageSource 回复错误 #2501

ReanRelay opened this issue Feb 15, 2023 · 1 comment
Labels
N 优先级: 一般 s:core 子系统: mirai-core t:problem 类型: 不容易归类为特性或 bug 的综合问题 x:protocol 属性: 协议相关
Milestone

Comments

@ReanRelay
Copy link

问题描述

消息源编码 转 字符串, 字符串解码 转 消息源, 引用回复 At 出现 At 变空白

复现

如以下代码:

val json = Json{
      Mirai
      serializersModule = MessageSerializers.serializersModule
      ignoreUnknownKeys = true
}

/** 机器人收到的群消息的事件 */
bot.eventChannel.subscribeAlways<GroupMessageEvent> { ev ->
    GlobalScope.launch {
        var msgSrc = message[MessageSource]!!
        val hashMap = HashMap<String, String>()
  
        hashMap["messageSrc"] = json.encodeToString(MessageSource.serializer(), msgSrc)

          //去掉此句,引用回复可以 at, 不知道为什么使用此句解码就不可用 at 
          msgSrc = json.decodeFromString(MessageSource.serializer(), hashMap["messageSrc"].toString())

          val group = bot.getGroup(msgSrc.targetId)
          val chain = msgSrc.quote() + At(qq号码)

          group?.sendMessage(chain)
    }
}

mirai-core 版本

2.14.0

bot-protocol

ANDROID_PHONE

其他组件版本

No response

系统日志

No response

网络日志

No response

补充信息

No response

@ReanRelay
Copy link
Author

。。。。。。。。。。。

@Karlatemp Karlatemp added x:protocol 属性: 协议相关 N 优先级: 一般 t:problem 类型: 不容易归类为特性或 bug 的综合问题 s:core 子系统: mirai-core labels Feb 16, 2023
@Karlatemp Karlatemp changed the title 引用回复 BUG OfflineMessageSource 回复错误 Feb 16, 2023
@Karlatemp Karlatemp added this to the 2.15.0-RC milestone Feb 16, 2023
@Him188 Him188 modified the milestones: 2.15.0-RC, 2.15.0-M1 Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
N 优先级: 一般 s:core 子系统: mirai-core t:problem 类型: 不容易归类为特性或 bug 的综合问题 x:protocol 属性: 协议相关
Projects
None yet
Development

No branches or pull requests

3 participants