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

MessageMetadata

interface MessageMetadata : SingleMessage

消息元数据, 即不含内容的元素.

所有子类的 contentToString 都应该返回空字符串.

See Also

MessageSource

QuoteReply

CustomMessageMetadata

ConstrainSingle

Extension Functions

flatten

扁平化 Message

fun Message.flatten(): Sequence<SingleMessage>

isContentEmpty

判断消息内容是否为空.

fun Message.isContentEmpty(): Boolean

isContentNotEmpty

fun Message.isContentNotEmpty(): Boolean

isNotPlain

fun Message.isNotPlain(): Boolean

isNotPlain2

fun Message.isNotPlain2(): Boolean

isPlain

fun Message.isPlain(): Boolean

isPlain2

fun Message.isPlain2(): Boolean

repeat

fun Message.repeat(count: Int): MessageChain

repeat2

fun Message.repeat2(count: Int): MessageChain

sendTo

suspend fun <C : Contact> Message.sendTo(contact: C): MessageReceipt<C>

times

operator fun Message.times(count: Int): MessageChain

toForwardMessage

转换为 ForwardMessage

fun Message.toForwardMessage(sender: User, time: Int = currentTimeSeconds.toInt(), displayStrategy: DisplayStrategy = DisplayStrategy): ForwardMessage
fun Message.toForwardMessage(senderId: Long, senderName: String, time: Int = currentTimeSeconds.toInt(), displayStrategy: DisplayStrategy = DisplayStrategy): ForwardMessage

Inheritors

ConstrainSingle

约束一个 MessageChain 中只存在这一种类型的元素. 新元素将会替换旧元素, 保持原顺序.

interface ConstrainSingle<out M : Message> : MessageMetadata

CustomMessageMetadata

自定义消息元数据.

abstract class CustomMessageMetadata : CustomMessage, MessageMetadata

MessageSource

消息源, 它存在于 MessageChain 中, 用于表示这个消息的来源.

sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<MessageSource>

QuoteReply

引用回复.

class QuoteReply : Message, MessageMetadata, ConstrainSingle<QuoteReply>