mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-29 09:10:11 +08:00
[core] Fix replying unavailable member's message
This commit is contained in:
parent
07164cc79b
commit
275d9f8f6e
@ -157,17 +157,27 @@ internal class QuoteReplyProtocol : MessageProtocol(PRIORITY_METADATA) {
|
|||||||
markAsConsumed()
|
markAsConsumed()
|
||||||
collect(ImMsgBody.Elem(srcMsg = source.toJceData()))
|
collect(ImMsgBody.Elem(srcMsg = source.toJceData()))
|
||||||
if (sourceCommon.kind == MessageSourceKind.GROUP) {
|
if (sourceCommon.kind == MessageSourceKind.GROUP) {
|
||||||
|
|
||||||
|
@Suppress("RemoveExplicitTypeArguments")
|
||||||
|
val needPlusAt = sequence<Boolean> {
|
||||||
if (source is OnlineMessageSource.Incoming.FromGroup) {
|
if (source is OnlineMessageSource.Incoming.FromGroup) {
|
||||||
|
try {
|
||||||
val sender0 = source.sender
|
val sender0 = source.sender
|
||||||
if (sender0 !is AnonymousMember) {
|
yield(sender0 !is AnonymousMember)
|
||||||
processAlso(At(sender0))
|
} catch (_: IllegalStateException) {
|
||||||
|
// Member not available now
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
yield(sourceCommon.fromId != 80000000L)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needPlusAt.first()) {
|
||||||
|
processAlso(At(sourceCommon.fromId))
|
||||||
|
|
||||||
// transformOneMessage(PlainText(" "))
|
// transformOneMessage(PlainText(" "))
|
||||||
// removed by https://github.com/mamoe/mirai/issues/524
|
// removed by https://github.com/mamoe/mirai/issues/524
|
||||||
// 发送 QuoteReply 消息时无可避免的产生多余空格 #524
|
// 发送 QuoteReply 消息时无可避免的产生多余空格 #524
|
||||||
} else if (sourceCommon.fromId != 80000000L) {
|
|
||||||
// https://github.com/mamoe/mirai/issues/2501 OfflineMessageSource quote replying
|
|
||||||
processAlso(At(sourceCommon.fromId))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user