diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceFromMsg.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceFromMsg.kt index fe4aab43f..e0d351c50 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceFromMsg.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceFromMsg.kt @@ -22,6 +22,7 @@ internal inline class MessageSourceFromServer( val delegate: ImMsgBody.SourceMsg ) : MessageSource { override val time: Long get() = delegate.time.toLong() and 0xFFFFFFFF + override val sequenceId: Int get() = delegate.origSeqs?.firstOrNull() ?: error("cannot find sequenceId from ImMsgBody.SourceMsg") override val messageUid: Long get() = delegate.pbReserve.loadAs(SourceMsg.ResvAttr.serializer()).origUids!! override val sourceMessage: MessageChain get() = delegate.toMessageChain() override val senderId: Long get() = delegate.senderUin @@ -34,6 +35,7 @@ internal inline class MessageSourceFromMsg( val delegate: MsgComm.Msg ) : MessageSource { override val time: Long get() = delegate.msgHead.msgTime.toLong() and 0xFFFFFFFF + override val sequenceId: Int get() = delegate.msgHead.msgSeq override val messageUid: Long get() = delegate.msgBody.richText.attr!!.random.toLong() override val sourceMessage: MessageChain get() = delegate.toMessageChain() override val senderId: Long get() = delegate.msgHead.fromUin diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt index e5b831b17..6804a18fc 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt @@ -26,6 +26,11 @@ import kotlin.jvm.JvmName interface MessageSource : Message { companion object Key : Message.Key + /** + * 序列号 + */ + val sequenceId: Int + /** * 实际上是个随机数, 但服务器确实是用它当做 uid */