mirai-core / net.mamoe.mirai.message / MessageReceipt

MessageReceipt

open class MessageReceipt<out C : Contact>

发送消息后得到的回执. 可用于撤回.

此对象持有 Contact 的弱引用, Bot 离线后将会释放引用, 届时 target 将无法访问.

Parameters

source - 指代发送出去的消息

target - 消息发送对象

See Also

Group.sendMessage

QQ.sendMessage

Member.sendMessage

MessageReceipt.sourceId

MessageReceipt.sourceTime

Constructors

<init>

发送消息后得到的回执. 可用于撤回.

MessageReceipt(source: Outgoing, target: C, botAsMember: Member?)

Properties

botAsMember

val botAsMember: Member?

isToGroup

是否为发送给群的消息的回执

val isToGroup: Boolean

source

指代发送出去的消息.

val source: Outgoing

target

发送目标, 为 GroupQQMember

val target: C

Functions

__quoteBlockingForJava__

fun __quoteBlockingForJava__(): QuoteReply

__quoteReplyBlockingForJava__

fun __quoteReplyBlockingForJava__(message: Message): MessageReceipt<C>
fun __quoteReplyBlockingForJava__(message: String): MessageReceipt<C>

__recallBlockingForJava__

fun __recallBlockingForJava__(): Unit

__recallInBlockingForJava__

fun __recallInBlockingForJava__(timeMillis: Long): Job

__recallInBlockingForJava__2

fun __recallInBlockingForJava__2(timeMillis: Long): Job

Extension Properties

sourceId

获取源消息 MessageSource.id

val MessageReceipt<*>.sourceId: Int

sourceTime

获取源消息 MessageSource.time

val MessageReceipt<*>.sourceTime: Int

Extension Functions

quote

引用这条消息.

fun MessageReceipt<*>.quote(): QuoteReply

quoteReply

引用这条消息并回复.

suspend fun <C : Contact> MessageReceipt<C>.quoteReply(message: Message): MessageReceipt<C>
suspend fun <C : Contact> MessageReceipt<C>.quoteReply(message: String): MessageReceipt<C>

recall

撤回这条消息. recallrecallIn 只能被调用一次.

suspend fun MessageReceipt<*>.recall(): Unit

recallIn

在一段时间后撤回这条消息. recallrecallIn 只能被调用一次.

fun MessageReceipt<*>.recallIn(timeMillis: Long, coroutineContext: CoroutineContext = EmptyCoroutineContext): Job