mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 06:10:30 +08:00
Fix Message.Key
This commit is contained in:
parent
864cde060e
commit
ca85eb6258
@ -147,6 +147,15 @@ fun <M : Message> MessageChain.firstOrNull(key: Message.Key<M>): M? = when (key)
|
||||
Face -> firstOrNull<Face>()
|
||||
QuoteReply -> firstOrNull<QuoteReply>()
|
||||
MessageSource -> firstOrNull<MessageSource>()
|
||||
OnlineMessageSource -> firstOrNull<OnlineMessageSource>()
|
||||
OfflineMessageSource -> firstOrNull<OfflineMessageSource>()
|
||||
OnlineMessageSource.Outgoing -> firstOrNull<OnlineMessageSource.Outgoing>()
|
||||
OnlineMessageSource.Outgoing.ToGroup -> firstOrNull<OnlineMessageSource.Outgoing.ToGroup>()
|
||||
OnlineMessageSource.Outgoing.ToFriend -> firstOrNull<OnlineMessageSource.Outgoing.ToFriend>()
|
||||
OnlineMessageSource.Incoming -> firstOrNull<OnlineMessageSource.Incoming>()
|
||||
OnlineMessageSource.Incoming.FromGroup -> firstOrNull<OnlineMessageSource.Incoming.FromGroup>()
|
||||
OnlineMessageSource.Incoming.FromFriend -> firstOrNull<OnlineMessageSource.Incoming.FromFriend>()
|
||||
OnlineMessageSource -> firstOrNull<OnlineMessageSource>()
|
||||
XmlMessage -> firstOrNull<XmlMessage>()
|
||||
JsonMessage -> firstOrNull<JsonMessage>()
|
||||
RichMessage -> firstOrNull<RichMessage>()
|
||||
|
@ -193,11 +193,13 @@ fun MessageChain.quote(): QuoteReply {
|
||||
return QuoteReply(this.source as? OnlineMessageSource ?: error("only online messages can be quoted"))
|
||||
}
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun MessageSource.recall() = bot.recall(this)
|
||||
|
||||
/**
|
||||
* 撤回这条消息
|
||||
*/
|
||||
@JvmSynthetic
|
||||
inline fun MessageSource.recallIn(
|
||||
timeMillis: Long,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext
|
||||
@ -247,8 +249,10 @@ inline val MessageChain.id: Int
|
||||
inline val MessageChain.source: MessageSource
|
||||
get() = this[MessageSource]
|
||||
|
||||
@JvmSynthetic
|
||||
suspend inline fun MessageChain.recall() = this.source.recall()
|
||||
|
||||
@JvmSynthetic
|
||||
inline fun MessageChain.recallIn(
|
||||
millis: Long,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext
|
||||
|
Loading…
Reference in New Issue
Block a user