@@ -3,6 +3,7 @@ package net.lz1998.mirai.utils
33import kotlinx.coroutines.Dispatchers
44import kotlinx.coroutines.withContext
55import net.lz1998.mirai.alias.BMessage
6+ import net.lz1998.mirai.ext.messageSourceLru
67import net.mamoe.mirai.Bot
78import net.mamoe.mirai.contact.Contact
89import net.mamoe.mirai.contact.Group
@@ -33,6 +34,7 @@ suspend fun protoMessageToMiraiMessage(msgList: List<BMessage>, bot: Bot, contac
3334 " at" -> messageChain.add(protoAtToMiraiAt(it.dataMap, bot, contact))
3435 " record" -> messageChain.add(protoVoiceToMiraiVoice(it.dataMap, contact))
3536 " voice" -> messageChain.add(protoVoiceToMiraiVoice(it.dataMap, contact))
37+ " reply" -> messageChain.add(protoReplyToMiraiReply(it.dataMap, contact))
3638 else -> MSG_EMPTY
3739 }
3840 }
@@ -85,6 +87,11 @@ suspend fun protoVoiceToMiraiVoice(dataMap: Map<String, String>, contact: Contac
8587
8688}
8789
90+ fun protoReplyToMiraiReply (dataMap : Map <String , String >, contact : Contact ): Message {
91+ val messageSource = contact.bot.messageSourceLru[dataMap[" message_id" ]?.toInt()] ? : return MSG_EMPTY
92+ return QuoteReply (messageSource)
93+ }
94+
8895suspend fun rawMessageToMiraiMessage (str : String , bot : Bot , contact : Contact ): List <Message > {
8996 val messageList = mutableListOf<Message >()
9097 var str = str
@@ -120,6 +127,7 @@ suspend fun rawMessageToMiraiMessage(str: String, bot: Bot, contact: Contact): L
120127 " text" -> messageList.add(protoTextToMiraiText(dataMap))
121128 " record" -> messageList.add(protoVoiceToMiraiVoice(dataMap, contact))
122129 " voice" -> messageList.add(protoVoiceToMiraiVoice(dataMap, contact))
130+ " reply" -> messageList.add(protoReplyToMiraiReply(dataMap, contact))
123131 }
124132 }
125133
0 commit comments