mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-22 13:46:13 +08:00
[core] Add internal message when failed to transform internal message to facade message
This commit is contained in:
parent
ec5870e0b3
commit
00486e7900
@ -24,6 +24,7 @@ import net.mamoe.mirai.internal.message.source.*
|
|||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||||
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm
|
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm
|
||||||
import net.mamoe.mirai.message.data.*
|
import net.mamoe.mirai.message.data.*
|
||||||
|
import net.mamoe.mirai.utils.structureToString
|
||||||
import net.mamoe.mirai.utils.toLongUnsigned
|
import net.mamoe.mirai.utils.toLongUnsigned
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,6 +105,24 @@ private fun List<MsgComm.Msg>.toMessageChain(
|
|||||||
onlineSource: Boolean?,
|
onlineSource: Boolean?,
|
||||||
messageSourceKind: MessageSourceKind,
|
messageSourceKind: MessageSourceKind,
|
||||||
facade: MessageProtocolFacade = MessageProtocolFacade,
|
facade: MessageProtocolFacade = MessageProtocolFacade,
|
||||||
|
): MessageChain {
|
||||||
|
try {
|
||||||
|
return toMessageChainImpl(bot, groupIdOrZero, onlineSource, messageSourceKind, facade)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw IllegalStateException(
|
||||||
|
"Failed to transform internal message to facade message, msg=${this@toMessageChain.structureToString()}",
|
||||||
|
e
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun List<MsgComm.Msg>.toMessageChainImpl(
|
||||||
|
bot: Bot,
|
||||||
|
groupIdOrZero: Long,
|
||||||
|
onlineSource: Boolean?,
|
||||||
|
messageSourceKind: MessageSourceKind,
|
||||||
|
facade: MessageProtocolFacade = MessageProtocolFacade,
|
||||||
): MessageChain {
|
): MessageChain {
|
||||||
val messageList = this
|
val messageList = this
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user