mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-30 10:50:18 +08:00
Fix references
This commit is contained in:
parent
49513790d5
commit
dc00c84820
@ -21,6 +21,7 @@ import net.mamoe.mirai.event.events.NewFriendRequestEvent
|
||||
import net.mamoe.mirai.message.MessageReceipt
|
||||
import net.mamoe.mirai.message.action.Nudge
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.recall
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalApi
|
||||
import net.mamoe.mirai.utils.MiraiInternalApi
|
||||
|
||||
@ -85,11 +86,11 @@ public interface IMirai : LowLevelApiAccessor {
|
||||
* @throws PermissionDeniedException 当 [Bot] 无权限操作时抛出
|
||||
* @throws IllegalStateException 当这条消息已经被撤回时抛出 (仅同步主动操作)
|
||||
*
|
||||
* @see IMirai.recall (扩展函数) 接受参数 [MessageChain]
|
||||
* @see IMirai.recallMessage (扩展函数) 接受参数 [MessageChain]
|
||||
* @see MessageSource.recall 撤回消息扩展
|
||||
*/
|
||||
@JvmBlockingBridge
|
||||
public suspend fun recall(bot: Bot, source: MessageSource)
|
||||
public suspend fun recallMessage(bot: Bot, source: MessageSource)
|
||||
|
||||
@JvmBlockingBridge
|
||||
public suspend fun sendNudge(bot: Bot, nudge: Nudge, receiver: Contact): Boolean
|
||||
@ -194,11 +195,11 @@ public interface IMirai : LowLevelApiAccessor {
|
||||
* [Bot] 撤回群员的消息需要管理员权限, 可在任意时间撤回.
|
||||
*
|
||||
* @throws PermissionDeniedException 当 [Bot] 无权限操作时
|
||||
* @see IMirai.recall
|
||||
* @see IMirai.recallMessage
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public suspend inline fun IMirai.recall(bot: Bot, message: MessageChain): Unit =
|
||||
this.recall(bot, message.source)
|
||||
public suspend inline fun IMirai.recallMessage(bot: Bot, message: MessageChain): Unit =
|
||||
this.recallMessage(bot, message.source)
|
||||
|
||||
@JvmSynthetic
|
||||
internal expect fun findMiraiInstance(): IMirai
|
@ -86,13 +86,13 @@ public suspend inline fun <T : Contact> T.sendMessage(message: String): MessageR
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IMirai.recall
|
||||
* @see IMirai.recallMessage
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public suspend inline fun Contact.recall(source: MessageChain): Unit = Mirai.recall(bot, source)
|
||||
public suspend inline fun Contact.recallMessage(source: MessageChain): Unit = Mirai.recallMessage(bot, source)
|
||||
|
||||
/**
|
||||
* @see IMirai.recall
|
||||
* @see IMirai.recallMessage
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public suspend inline fun Contact.recall(source: MessageSource): Unit = Mirai.recall(bot, source)
|
||||
public suspend inline fun Contact.recallMessage(source: MessageSource): Unit = Mirai.recallMessage(bot, source)
|
@ -250,7 +250,7 @@ public data class TempMessagePostSendEvent internal constructor(
|
||||
/**
|
||||
* 消息撤回事件. 可是任意消息被任意人撤回.
|
||||
*
|
||||
* @see Contact.recall 撤回消息. 为广播这个事件的唯一途径
|
||||
* @see Contact.recallMessage 撤回消息. 为广播这个事件的唯一途径
|
||||
*/
|
||||
public sealed class MessageRecallEvent : BotEvent, AbstractEvent() {
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@ import net.mamoe.mirai.contact.*
|
||||
import net.mamoe.mirai.event.events.BotEvent
|
||||
import net.mamoe.mirai.event.subscribe
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.quote
|
||||
import net.mamoe.mirai.utils.ExternalImage
|
||||
import net.mamoe.mirai.utils.sendTo
|
||||
import net.mamoe.mirai.utils.upload
|
||||
|
@ -15,6 +15,7 @@ import net.mamoe.mirai.IMirai
|
||||
import net.mamoe.mirai.Mirai
|
||||
import net.mamoe.mirai.contact.*
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.quote
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalApi
|
||||
|
||||
/**
|
||||
@ -25,7 +26,7 @@ import net.mamoe.mirai.utils.MiraiExperimentalApi
|
||||
*
|
||||
* @see quote 引用这条消息. 即引用机器人自己发出去的消息
|
||||
* @see quoteReply 引用并回复这条消息.
|
||||
* @see recall 撤回这条消息
|
||||
* @see recallMessage 撤回这条消息
|
||||
*
|
||||
* @see Group.sendMessage 发送群消息, 返回回执(此对象)
|
||||
* @see User.sendMessage 发送群消息, 返回回执(此对象)
|
||||
@ -57,13 +58,13 @@ public open class MessageReceipt<out C : Contact> @MiraiExperimentalApi("The con
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回这条消息. [recall] 或 [recallIn] 只能被调用一次.
|
||||
* 撤回这条消息. [recallMessage] 或 [recallIn] 只能被调用一次.
|
||||
*
|
||||
* @see IMirai.recall
|
||||
* @see IMirai.recallMessage
|
||||
* @throws IllegalStateException 当此消息已经被撤回或正计划撤回时
|
||||
*/
|
||||
public suspend inline fun MessageReceipt<*>.recall() {
|
||||
return Mirai.recall(target.bot, source)
|
||||
return Mirai.recallMessage(target.bot, source)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,9 +50,9 @@ import net.mamoe.mirai.utils.LazyProperty
|
||||
*
|
||||
* ### 使用
|
||||
*
|
||||
* 消息源可用于 [引用回复][QuoteReply] 或 [撤回][IMirai.recall].
|
||||
* 消息源可用于 [引用回复][QuoteReply] 或 [撤回][IMirai.recallMessage].
|
||||
*
|
||||
* @see IMirai.recall 撤回一条消息
|
||||
* @see IMirai.recallMessage 撤回一条消息
|
||||
* @see MessageSource.quote 引用这条消息, 创建 [MessageChain]
|
||||
*
|
||||
* @see OnlineMessageSource 在线消息的 [MessageSource]
|
||||
@ -146,11 +146,13 @@ public sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<Me
|
||||
* @throws PermissionDeniedException 当 [Bot] 无权限操作时
|
||||
* @throws IllegalStateException 当这条消息已经被撤回时 (仅同步主动操作)
|
||||
*
|
||||
* @see IMirai.recall
|
||||
* @see IMirai.recallMessage
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmBlockingBridge
|
||||
public suspend inline fun MessageSource.recall(): Unit = Mirai.recall(bot, this)
|
||||
public suspend inline fun MessageSource.recall() {
|
||||
Mirai.recallMessage(bot, this@recall)
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回这条消息. 可撤回自己 2 分钟内发出的消息, 和任意时间的群成员的消息.
|
||||
@ -165,7 +167,7 @@ public sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<Me
|
||||
* @throws PermissionDeniedException 当 [Bot] 无权限操作时
|
||||
* @throws IllegalStateException 当这条消息已经被撤回时 (仅同步主动操作)
|
||||
*
|
||||
* @see IMirai.recall
|
||||
* @see IMirai.recallMessage
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmBlockingBridge
|
||||
@ -222,7 +224,7 @@ public sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<Me
|
||||
|
||||
/**
|
||||
* 在线消息的 [MessageSource].
|
||||
* 拥有对象化的 [sender], [target], 也可以直接 [recall] 和 [quote]
|
||||
* 拥有对象化的 [sender], [target], 也可以直接 [recallMessage] 和 [quote]
|
||||
*
|
||||
* ### 来源
|
||||
* - 当 bot 主动发送消息时, 产生 (由协议模块主动构造) [OnlineMessageSource.Outgoing]
|
||||
|
@ -19,6 +19,11 @@ import net.mamoe.mirai.contact.ContactOrBot
|
||||
import net.mamoe.mirai.contact.Friend
|
||||
import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.contact.Member
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.isAboutFriend
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.isAboutGroup
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.isAboutTemp
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.quote
|
||||
import net.mamoe.mirai.message.data.MessageSource.Key.recall
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalApi
|
||||
import net.mamoe.mirai.utils.currentTimeSeconds
|
||||
|
||||
|
@ -254,7 +254,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
}
|
||||
|
||||
@Suppress("RemoveExplicitTypeArguments") // false positive
|
||||
override suspend fun recall(bot: Bot, source: MessageSource) = bot.asQQAndroidBot().run {
|
||||
override suspend fun recallMessage(bot: Bot, source: MessageSource) = bot.asQQAndroidBot().run {
|
||||
check(source is MessageSourceInternal)
|
||||
|
||||
source.ensureSequenceIdAvailable()
|
||||
|
Loading…
Reference in New Issue
Block a user