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

RichMessage

@SinceMirai("0.27.0") interface RichMessage : MessageContent

XML 消息等富文本消息

See Also

ServiceMessage

LightApp

Types

Templates

companion object Templates : Key<RichMessage>

Properties

content

abstract val content: String

Functions

contentToString

转为最接近官方格式的字符串. 如 At(member) + "test" 将转为 "@群名片 test".

open fun contentToString(): String

Companion Object Properties

typeName

Key 指代的 Message 类型名. 一般为 class.simpleName, 如 "QuoteReply", "PlainText"

val typeName: String

Companion Object Functions

share

fun share(url: String, title: String? = null, content: String? = null, coverUrl: String? = null): ServiceMessage

shareDeprecated

fun shareDeprecated(url: String, title: String? = null, content: String? = null, coverUrl: String? = null): XmlMessage

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

LightApp

小程序, 如音乐分享.

data class LightApp : RichMessage

ServiceMessage

服务消息, 如 XmlMessage.

open class ServiceMessage : RichMessage