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

QuoteReply

@SinceMirai("0.33.0") class QuoteReply : Message, MessageMetadata, ConstrainSingle<QuoteReply>

引用回复.

支持引用任何一条消息发送给任何人.

source 的类型:

原消息内容

引用回复的原消息内容完全由 sourceMessageSource.originalMessage 控制, 客户端不会自行寻找原消息.

客户端内跳转

客户端在跳转原消息时, 会通过 MessageSource.id 等 metadata

See Also

MessageSource

Types

Key

companion object Key : Key<QuoteReply>

Constructors

<init>

引用回复.

QuoteReply(source: MessageSource)

Properties

key

val key: Key<QuoteReply>

source

val source: MessageSource

Functions

contentToString

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

fun contentToString(): String

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

toString

得到包含 mirai 消息元素代码的, 易读的字符串. 如 At(member) + "test" 将转为 "[mirai:at:qqId]test"

fun toString(): String

Companion Object Properties

typeName

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

val typeName: String

Extension Properties

bot

val QuoteReply.bot: Bot

fromId

val QuoteReply.fromId: Long

id

val QuoteReply.id: Int

internalId

val QuoteReply.internalId: Int

originalMessage

val QuoteReply.originalMessage: MessageChain

targetId

val QuoteReply.targetId: Long

time

val QuoteReply.time: Int

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

recall

suspend fun QuoteReply.recall(): Unit

recallIn

在一段时间后撤回这条消息.

fun QuoteReply.recallIn(millis: Long, coroutineContext: CoroutineContext = EmptyCoroutineContext): Job

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