mirai-core / net.mamoe.mirai.message.data / MessageChainBuilder

MessageChainBuilder

open class MessageChainBuilder : MutableList<SingleMessage>, Appendable

MessageChain 构建器. 多个连续的 String 会被连接为单个 PlainText 以优化性能.

注意: 无并发安全性.

See Also

buildMessageChain

asMessageChain

Constructors

<init>

MessageChainBuilder()
MessageChainBuilder(initialSize: Int)

Functions

add

fun add(element: SingleMessage): Boolean
fun add(element: Message): Boolean
fun add(plain: String): Unit

addAll

fun addAll(elements: Collection<SingleMessage>): Boolean
fun addAll(elements: Iterable<SingleMessage>): Boolean
fun addAll(elements: Iterable<Message>): Boolean

append

fun append(value: Char): MessageChainBuilder
fun append(value: CharSequence?): MessageChainBuilder
fun append(value: CharSequence?, startIndex: Int, endIndex: Int): MessageChainBuilder
fun append(message: Message): MessageChainBuilder
fun append(message: SingleMessage): MessageChainBuilder

asMessageChain

fun asMessageChain(): MessageChain

build

asMessageChain

fun build(): MessageChain

clear

fun clear(): Unit

copy

将所有已有元素引用复制到一个新的 MessageChainBuilder

fun copy(): MessageChainBuilder

plusAssign

operator fun plusAssign(plain: String): Unit
operator fun plusAssign(message: Message): Unit
operator fun plusAssign(message: SingleMessage): Unit
operator fun plusAssign(charSequence: CharSequence): Unit

remove

fun remove(element: SingleMessage): Boolean

removeAll

fun removeAll(elements: Collection<SingleMessage>): Boolean

removeAt

fun removeAt(index: Int): SingleMessage

set

fun set(index: Int, element: SingleMessage): SingleMessage

unaryPlus

operator fun Message.unaryPlus(): Unit
operator fun String.unaryPlus(): Unit