Skip to content

Commit e270549

Browse files
committed
reply
1 parent 1d81322 commit e270549

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ src/main/java/dto/
4444
.DS_Store
4545

4646

47-
device/
47+
device/
48+
.wakatime-project

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ plugins {
2828
}
2929

3030
group = "net.lz1998"
31-
version = "0.0.11"
31+
version = "0.0.12"
3232
java.sourceCompatibility = JavaVersion.VERSION_1_8
3333

3434
configurations {

src/main/kotlin/net/lz1998/mirai/utils/MsgConverter.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package net.lz1998.mirai.utils
33
import kotlinx.coroutines.Dispatchers
44
import kotlinx.coroutines.withContext
55
import net.lz1998.mirai.alias.BMessage
6+
import net.lz1998.mirai.ext.messageSourceLru
67
import net.mamoe.mirai.Bot
78
import net.mamoe.mirai.contact.Contact
89
import 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+
8895
suspend 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

Comments
 (0)