mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-07 15:56:57 +08:00
Remove confusing At and space before QuoteReply, fix #522
This commit is contained in:
parent
22112d222b
commit
838b094487
@ -301,6 +301,17 @@ private fun MessageChain.cleanupRubbishMessageElements(): MessageChain {
|
|||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (element is QuoteReply) {
|
||||||
|
// 客户端为兼容早期不支持 QuoteReply 的客户端而添加的 At
|
||||||
|
removeLastOrNull()?.let { rm ->
|
||||||
|
if ((rm as? PlainText)?.content != " ") add(rm)
|
||||||
|
else removeLastOrNull()?.let { rm2 ->
|
||||||
|
if (rm2 !is At) add(rm2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
add(element)
|
add(element)
|
||||||
last = element
|
last = element
|
||||||
}
|
}
|
||||||
@ -320,7 +331,7 @@ internal val MIRAI_CUSTOM_ELEM_TYPE = "mirai".hashCode() // 103904510
|
|||||||
|
|
||||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||||
internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: Bot, list: MessageChainBuilder) {
|
internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: Bot, list: MessageChainBuilder) {
|
||||||
// (this._miraiContentToString())
|
(this._miraiContentToString().soutv())
|
||||||
this.forEach { element ->
|
this.forEach { element ->
|
||||||
when {
|
when {
|
||||||
element.srcMsg != null -> {
|
element.srcMsg != null -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user