mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 01:30:17 +08:00
Add sequenceId to MessageSource
This commit is contained in:
parent
776e591556
commit
ff8e6e8b80
@ -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
|
||||
|
@ -26,6 +26,11 @@ import kotlin.jvm.JvmName
|
||||
interface MessageSource : Message {
|
||||
companion object Key : Message.Key<MessageSource>
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
val sequenceId: Int
|
||||
|
||||
/**
|
||||
* 实际上是个随机数, 但服务器确实是用它当做 uid
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user