-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
N优先级: 一般优先级: 一般s:core子系统: mirai-core子系统: mirai-coret:problem类型: 不容易归类为特性或 bug 的综合问题类型: 不容易归类为特性或 bug 的综合问题x:protocol属性: 协议相关属性: 协议相关
Milestone
Description
问题描述
消息源编码 转 字符串, 字符串解码 转 消息源, 引用回复 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
Metadata
Metadata
Assignees
Labels
N优先级: 一般优先级: 一般s:core子系统: mirai-core子系统: mirai-coret:problem类型: 不容易归类为特性或 bug 的综合问题类型: 不容易归类为特性或 bug 的综合问题x:protocol属性: 协议相关属性: 协议相关