Fix MessageChainBuilder.copy not copying caches

This commit is contained in:
Karlatemp 2021-09-10 12:55:00 +08:00
parent 25c489d238
commit 16ad3bc042
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8

View File

@ -186,7 +186,9 @@ public class MessageChainBuilder private constructor(
* 将所有已有元素引用复制到一个新的 [MessageChainBuilder]
*/
public fun copy(): MessageChainBuilder {
return MessageChainBuilder(container.toMutableList())
return MessageChainBuilder(container.toMutableList()).also {
it.cache.append(this.cache)
}
}
public override fun remove(element: SingleMessage): Boolean {