mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-01 03:50:18 +08:00
Ignore offline messages
This commit is contained in:
parent
f634a5282f
commit
f7092976f1
@ -121,13 +121,16 @@ internal class MessageSvc {
|
|||||||
val messages = resp.uinPairMsgs.asSequence().filterNot { it.msg == null }.flatMap { it.msg!!.asSequence() }.mapNotNull {
|
val messages = resp.uinPairMsgs.asSequence().filterNot { it.msg == null }.flatMap { it.msg!!.asSequence() }.mapNotNull {
|
||||||
when (it.msgHead.msgType) {
|
when (it.msgHead.msgType) {
|
||||||
166 -> {
|
166 -> {
|
||||||
if (it.msgHead.fromUin == bot.uin) null
|
when {
|
||||||
else FriendMessage(
|
it.msgHead.fromUin == bot.uin -> null
|
||||||
|
!bot.firstLoginSucceed -> null
|
||||||
|
else -> FriendMessage(
|
||||||
bot,
|
bot,
|
||||||
bot.getFriend(it.msgHead.fromUin),
|
bot.getFriend(it.msgHead.fromUin),
|
||||||
it.msgBody.richText.toMessageChain()
|
it.msgBody.richText.toMessageChain()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
@ -173,7 +176,7 @@ internal class MessageSvc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class Failed(val errorCode: Int, val errorMessage: String) : Response() {
|
data class Failed(val errorCode: Int, val errorMessage: String) : Response() {
|
||||||
override fun toString(): String = "MessageSvc.PbSendMsg.Response.Failed(errorCode=$errorCode, errorMessage=$errorMessage"
|
override fun toString(): String = "MessageSvc.PbSendMsg.Response.Failed(errorCode=$errorCode, errorMessage=$errorMessage)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user