mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-13 06:30:13 +08:00
Remove all @SinceMirai("0.x.x")
This commit is contained in:
parent
4ee27f2069
commit
84cfe2626f
@ -24,11 +24,8 @@ import net.mamoe.mirai.qqandroid.utils.io.serialization.jceRequestSBuffer
|
||||
import net.mamoe.mirai.qqandroid.utils.io.serialization.readUniPacket
|
||||
import net.mamoe.mirai.qqandroid.utils.io.serialization.writeJceStruct
|
||||
import net.mamoe.mirai.qqandroid.utils.toByteArray
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
|
||||
internal class ProfileService {
|
||||
|
||||
@SinceMirai("0.37.0")
|
||||
object GroupMngReq : OutgoingPacketFactory<GroupMngReq.GroupMngReqResponse>("ProfileService.GroupMngReq") {
|
||||
data class GroupMngReqResponse(val errorCode: Int, val errorMessage: String) : Packet
|
||||
|
||||
|
@ -42,7 +42,6 @@ actual abstract class Group : Contact(), CoroutineScope {
|
||||
/**
|
||||
* 群设置
|
||||
*/
|
||||
@SinceMirai("0.30.0")
|
||||
actual abstract val settings: GroupSettings
|
||||
|
||||
/**
|
||||
|
@ -64,7 +64,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
/**
|
||||
* 复制一份此时的 [Bot] 实例列表.
|
||||
*/
|
||||
@SinceMirai("0.39.1")
|
||||
@JvmStatic
|
||||
val botInstances: List<Bot>
|
||||
get() = BotImpl.instances.asSequence().mapNotNull { it.get() }.toList()
|
||||
@ -92,13 +91,11 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
/**
|
||||
* QQ 号码. 实际类型为 uint
|
||||
*/
|
||||
@SinceMirai("0.32.0")
|
||||
abstract override val id: Long
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@SinceMirai("0.33.1")
|
||||
abstract val nick: String
|
||||
|
||||
/**
|
||||
@ -191,7 +188,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
* @param targetUin 为用户时为 [Friend.id], 为群时需使用 [Group.calculateGroupUinByGroupCode] 计算
|
||||
*/
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("0.39.0")
|
||||
abstract fun constructMessageSource(
|
||||
kind: OfflineMessageSource.Kind,
|
||||
fromUin: Long, targetUin: Long,
|
||||
@ -205,7 +201,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
*
|
||||
* @param event 好友验证的事件对象
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
@JvmSynthetic
|
||||
abstract suspend fun acceptNewFriendRequest(event: NewFriendRequestEvent)
|
||||
|
||||
@ -215,7 +210,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
* @param event 好友验证的事件对象
|
||||
* @param blackList 拒绝后是否拉入黑名单
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
@JvmSynthetic
|
||||
abstract suspend fun rejectNewFriendRequest(event: NewFriendRequestEvent, blackList: Boolean = false)
|
||||
|
||||
@ -224,7 +218,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
*
|
||||
* @param event 加群验证的事件对象
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
@JvmSynthetic
|
||||
abstract suspend fun acceptMemberJoinRequest(event: MemberJoinRequestEvent)
|
||||
|
||||
@ -234,7 +227,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
* @param event 加群验证的事件对象
|
||||
* @param blackList 拒绝后是否拉入黑名单
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
@JvmSynthetic
|
||||
abstract suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false)
|
||||
|
||||
@ -244,7 +236,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
* @param event 加群验证的事件对象
|
||||
* @param blackList 忽略后是否拉入黑名单
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
@JvmSynthetic
|
||||
abstract suspend fun ignoreMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false)
|
||||
|
||||
@ -253,7 +244,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
*
|
||||
* @param event 邀请入群的事件对象
|
||||
*/
|
||||
@SinceMirai("0.39.4")
|
||||
@JvmSynthetic
|
||||
abstract suspend fun acceptInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent)
|
||||
|
||||
@ -263,7 +253,6 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
|
||||
* @param event 邀请入群的事件对象
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@SinceMirai("0.39.4")
|
||||
abstract suspend fun ignoreInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent)
|
||||
|
||||
// endregion
|
||||
|
@ -10,7 +10,6 @@
|
||||
package net.mamoe.mirai.contact
|
||||
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
|
||||
/**
|
||||
* 拥有 [id] 的对象.
|
||||
@ -19,7 +18,6 @@ import net.mamoe.mirai.utils.SinceMirai
|
||||
* @see Contact
|
||||
* @see Bot
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
interface ContactOrBot {
|
||||
/**
|
||||
* QQ 号或群号.
|
||||
|
@ -12,14 +12,12 @@
|
||||
package net.mamoe.mirai.contact
|
||||
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
|
||||
/**
|
||||
* 发送消息时消息过长抛出的异常.
|
||||
*
|
||||
* @see Contact.sendMessage
|
||||
*/
|
||||
@SinceMirai("0.32.0")
|
||||
class MessageTooLargeException(
|
||||
val target: Contact,
|
||||
/**
|
||||
@ -38,7 +36,6 @@ class MessageTooLargeException(
|
||||
*
|
||||
* @see Group.sendMessage
|
||||
*/
|
||||
@SinceMirai("0.33.0")
|
||||
class BotIsBeingMutedException(
|
||||
val target: Group
|
||||
) : RuntimeException("bot is being muted, remaining ${target.botMuteRemaining} seconds")
|
||||
|
@ -47,7 +47,6 @@ abstract class Group : Contact(), CoroutineScope {
|
||||
/**
|
||||
* 群设置
|
||||
*/
|
||||
@SinceMirai("0.30.0")
|
||||
abstract val settings: GroupSettings
|
||||
|
||||
/**
|
||||
@ -122,7 +121,6 @@ abstract class Group : Contact(), CoroutineScope {
|
||||
* @return 退出成功时 true; 已经退出时 false
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@SinceMirai("0.37.0")
|
||||
abstract suspend fun quit(): Boolean
|
||||
|
||||
/**
|
||||
@ -196,7 +194,6 @@ abstract class Group : Contact(), CoroutineScope {
|
||||
@Suppress("FunctionName")
|
||||
@JvmName("quit")
|
||||
@JavaFriendlyAPI
|
||||
@SinceMirai("0.39.4")
|
||||
fun __quitBlockingForJava__(): Boolean = runBlocking { quit() }
|
||||
}
|
||||
|
||||
@ -205,7 +202,6 @@ abstract class Group : Contact(), CoroutineScope {
|
||||
*
|
||||
* @see Group.settings 获取群设置
|
||||
*/
|
||||
@SinceMirai("0.30.0")
|
||||
interface GroupSettings {
|
||||
/**
|
||||
* 入群公告, 没有时为空字符串.
|
||||
|
@ -19,7 +19,6 @@ import net.mamoe.mirai.message.MessageReceipt
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
import net.mamoe.mirai.message.data.toMessage
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import net.mamoe.mirai.utils.WeakRefProperty
|
||||
import kotlin.jvm.JvmSynthetic
|
||||
import kotlin.time.Duration
|
||||
@ -172,26 +171,22 @@ abstract class Member : MemberJavaFriendlyAPI() {
|
||||
*
|
||||
* @throws IllegalStateException 当此成员不是好友时抛出
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
fun Member.asFriend(): Friend = this.bot.getFriendOrNull(this.id) ?: error("$this is not a friend")
|
||||
|
||||
/**
|
||||
* 得到此成员作为好友的对象, 当此成员不是好友时返回 `null`
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
fun Member.asFriendOrNull(): Friend? = this.bot.getFriendOrNull(this.id)
|
||||
|
||||
/**
|
||||
* 判断此成员是否为好友
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
inline val Member.isFriend: Boolean
|
||||
get() = this.bot.friends.contains(this.id)
|
||||
|
||||
/**
|
||||
* 如果此成员是好友, 则执行 [block] 并返回其返回值. 否则返回 `null`
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
inline fun <R> Member.takeIfIsFriend(block: (Friend) -> R): R? {
|
||||
return this.asFriendOrNull()?.let(block)
|
||||
}
|
||||
@ -210,7 +205,6 @@ val Member.nameCardOrNick: String get() = this.nameCard.takeIf { it.isNotEmpty()
|
||||
*
|
||||
* 否则返回 [Member.nick]
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
val User.nameCardOrNick: String
|
||||
get() = when (this) {
|
||||
is Member -> this.nameCardOrNick
|
||||
@ -220,7 +214,6 @@ val User.nameCardOrNick: String
|
||||
/**
|
||||
* 判断群成员是否处于禁言状态.
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
val Member.isMuted: Boolean
|
||||
get() = muteTimeRemaining != 0 && muteTimeRemaining != 0xFFFFFFFF.toInt()
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
package net.mamoe.mirai.contact
|
||||
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.internal.InlineOnly
|
||||
|
||||
/**
|
||||
@ -46,7 +45,6 @@ enum class MemberPermission : Comparable<MemberPermission> {
|
||||
/**
|
||||
* 权限等级. [OWNER] 为 2, [ADMINISTRATOR] 为 1, [MEMBER] 为 0
|
||||
*/
|
||||
@SinceMirai("0.32.0")
|
||||
val level: Int
|
||||
get() = ordinal
|
||||
}
|
||||
|
@ -4,14 +4,12 @@ package net.mamoe.mirai.data
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
|
||||
|
||||
/**
|
||||
* 群统计信息
|
||||
*/
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("0.28.0")
|
||||
@Serializable
|
||||
data class GroupActiveData(
|
||||
|
||||
|
@ -28,7 +28,6 @@ import net.mamoe.mirai.qqandroid.network.Packet
|
||||
import net.mamoe.mirai.utils.ExternalImage
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import net.mamoe.mirai.utils.internal.runBlocking
|
||||
import kotlin.jvm.JvmField
|
||||
import kotlin.jvm.JvmName
|
||||
@ -78,7 +77,6 @@ sealed class BotOfflineEvent : BotEvent, AbstractEvent() {
|
||||
/**
|
||||
* 服务器主动要求更换另一个服务器
|
||||
*/
|
||||
@SinceMirai("0.37.1")
|
||||
data class RequireReconnect(override val bot: Bot) : BotOfflineEvent(), Packet, BotPassiveEvent
|
||||
}
|
||||
|
||||
@ -134,7 +132,6 @@ sealed class MessageRecallEvent : BotEvent, AbstractEvent() {
|
||||
* 消息内部 id.
|
||||
* @see MessageSource.id
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
abstract val messageInternalId: Int
|
||||
|
||||
/**
|
||||
@ -238,20 +235,17 @@ sealed class ImageUploadEvent : BotEvent, BotActiveEvent, AbstractEvent() {
|
||||
/**
|
||||
* 机器人被踢出群或在其他客户端主动退出一个群. 在事件广播前 [Bot.groups] 就已删除这个群.
|
||||
*/
|
||||
@SinceMirai("0.36.0")
|
||||
sealed class BotLeaveEvent : BotEvent, Packet, AbstractEvent() {
|
||||
abstract val group: Group
|
||||
|
||||
/**
|
||||
* 机器人主动退出一个群.
|
||||
*/
|
||||
@SinceMirai("0.37.0")
|
||||
data class Active(override val group: Group) : BotLeaveEvent()
|
||||
|
||||
/**
|
||||
* 机器人被管理员或群主踢出群. 暂不支持获取操作人
|
||||
*/
|
||||
@SinceMirai("0.37.0")
|
||||
data class Kick(override val group: Group) : BotLeaveEvent()
|
||||
|
||||
override val bot: Bot get() = group.bot
|
||||
@ -324,7 +318,6 @@ data class GroupNameChangeEvent(
|
||||
/**
|
||||
* 操作人. 为 null 时则是机器人操作
|
||||
*/
|
||||
@SinceMirai("0.37.3")
|
||||
override val operator: Member?
|
||||
) : GroupSettingChangeEvent<String>, Packet, GroupOperableEvent, AbstractEvent() {
|
||||
@Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@ -412,13 +405,11 @@ sealed class MemberJoinEvent(override val member: Member) : GroupMemberEvent, Bo
|
||||
/**
|
||||
* 被邀请加入群
|
||||
*/
|
||||
@SinceMirai("0.36.0")
|
||||
data class Invite(override val member: Member) : MemberJoinEvent(member)
|
||||
|
||||
/**
|
||||
* 成员主动加入群
|
||||
*/
|
||||
@SinceMirai("0.36.0")
|
||||
data class Active(override val member: Member) : MemberJoinEvent(member)
|
||||
}
|
||||
|
||||
@ -454,7 +445,6 @@ sealed class MemberLeaveEvent : GroupMemberEvent, AbstractEvent() {
|
||||
/**
|
||||
* [Bot] 被邀请加入一个群.
|
||||
*/
|
||||
@SinceMirai("0.39.4")
|
||||
data class BotInvitedJoinGroupRequestEvent(
|
||||
override val bot: Bot,
|
||||
/**
|
||||
@ -497,7 +487,6 @@ data class BotInvitedJoinGroupRequestEvent(
|
||||
/**
|
||||
* 一个账号请求加入群事件, [Bot] 在此群中是管理员或群主.
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
data class MemberJoinRequestEvent(
|
||||
override val bot: Bot,
|
||||
/**
|
||||
@ -653,7 +642,6 @@ data class MemberUnmuteEvent(
|
||||
/**
|
||||
* 好友昵称改变事件. 目前仅支持解析 (来自 PC 端的修改).
|
||||
*/
|
||||
@SinceMirai("0.36.0")
|
||||
data class FriendRemarkChangeEvent(
|
||||
override val bot: Bot,
|
||||
override val friend: Friend,
|
||||
@ -663,7 +651,6 @@ data class FriendRemarkChangeEvent(
|
||||
/**
|
||||
* 成功添加了一个新好友的事件
|
||||
*/
|
||||
@SinceMirai("0.36.0")
|
||||
data class FriendAddEvent(
|
||||
/**
|
||||
* 新好友. 已经添加到 [Bot.friends]
|
||||
@ -676,7 +663,6 @@ data class FriendAddEvent(
|
||||
/**
|
||||
* 好友已被删除的事件.
|
||||
*/
|
||||
@SinceMirai("0.36.0")
|
||||
data class FriendDeleteEvent(
|
||||
override val friend: Friend
|
||||
) : FriendEvent, Packet, AbstractEvent() {
|
||||
@ -686,7 +672,6 @@ data class FriendDeleteEvent(
|
||||
/**
|
||||
* 一个账号请求添加机器人为好友的事件
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
data class NewFriendRequestEvent(
|
||||
override val bot: Bot,
|
||||
/**
|
||||
|
@ -12,7 +12,6 @@
|
||||
package net.mamoe.mirai.event
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
import kotlin.jvm.JvmSynthetic
|
||||
@ -30,7 +29,6 @@ import kotlin.reflect.KClass
|
||||
* @throws Throwable 当 [mapper] 抛出任何异常时, 本函数会抛出该异常
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@SinceMirai("0.39.0")
|
||||
suspend inline fun <reified E : Event, R : Any> syncFromEvent(
|
||||
timeoutMillis: Long = -1,
|
||||
crossinline mapper: suspend E.(E) -> R?
|
||||
@ -60,7 +58,6 @@ suspend inline fun <reified E : Event, R : Any> syncFromEvent(
|
||||
* @throws Throwable 当 [mapper] 抛出任何异常时, 本函数会抛出该异常
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@SinceMirai("0.39.0")
|
||||
suspend inline fun <reified E : Event, R : Any> syncFromEventOrNull(
|
||||
timeoutMillis: Long,
|
||||
crossinline mapper: suspend E.(E) -> R?
|
||||
@ -83,7 +80,6 @@ suspend inline fun <reified E : Event, R : Any> syncFromEventOrNull(
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@Suppress("DeferredIsResult")
|
||||
@SinceMirai("0.39.0")
|
||||
inline fun <reified E : Event, R : Any> CoroutineScope.asyncFromEventOrNull(
|
||||
timeoutMillis: Long,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
@ -107,7 +103,6 @@ inline fun <reified E : Event, R : Any> CoroutineScope.asyncFromEventOrNull(
|
||||
*/
|
||||
@JvmSynthetic
|
||||
@Suppress("DeferredIsResult")
|
||||
@SinceMirai("0.39.0")
|
||||
inline fun <reified E : Event, R : Any> CoroutineScope.asyncFromEvent(
|
||||
timeoutMillis: Long = -1,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
|
@ -18,7 +18,6 @@ import net.mamoe.mirai.message.data.PlainText
|
||||
import net.mamoe.mirai.message.isContextIdenticalWith
|
||||
import net.mamoe.mirai.message.nextMessage
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
import kotlin.jvm.JvmName
|
||||
import kotlin.jvm.JvmSynthetic
|
||||
@ -59,7 +58,6 @@ import kotlin.jvm.JvmSynthetic
|
||||
* @see subscribeMessages
|
||||
* @see nextMessage 挂起协程并等待下一条消息
|
||||
*/
|
||||
@SinceMirai("0.29.0")
|
||||
@Suppress("unused")
|
||||
suspend inline fun <reified T : MessageEvent> T.whileSelectMessages(
|
||||
timeoutMillis: Long = -1,
|
||||
@ -72,7 +70,6 @@ suspend inline fun <reified T : MessageEvent> T.whileSelectMessages(
|
||||
*/
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("0.29.0")
|
||||
@JvmName("selectMessages1")
|
||||
suspend inline fun <reified T : MessageEvent> T.selectMessagesUnit(
|
||||
timeoutMillis: Long = -1,
|
||||
@ -101,7 +98,6 @@ suspend inline fun <reified T : MessageEvent> T.selectMessagesUnit(
|
||||
*
|
||||
* @see nextMessage 挂起协程并等待下一条消息
|
||||
*/
|
||||
@SinceMirai("0.29.0")
|
||||
@Suppress("unused") // false positive
|
||||
// @BuilderInference // https://youtrack.jetbrains.com/issue/KT-37716
|
||||
suspend inline fun <reified T : MessageEvent, R> T.selectMessages(
|
||||
@ -120,7 +116,6 @@ suspend inline fun <reified T : MessageEvent, R> T.selectMessages(
|
||||
* @see MessageSelectBuilderUnit 查看上层 API
|
||||
*/
|
||||
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
|
||||
@SinceMirai("0.29.0")
|
||||
abstract class MessageSelectBuilder<M : MessageEvent, R> @PublishedApi internal constructor(
|
||||
ownerMessagePacket: M,
|
||||
stub: Any?,
|
||||
@ -235,7 +230,6 @@ abstract class MessageSelectBuilder<M : MessageEvent, R> @PublishedApi internal
|
||||
*
|
||||
* @see MessageSubscribersBuilder 查看上层 API
|
||||
*/
|
||||
@SinceMirai("0.29.0")
|
||||
abstract class MessageSelectBuilderUnit<M : MessageEvent, R> @PublishedApi internal constructor(
|
||||
private val ownerMessagePacket: M,
|
||||
stub: Any?,
|
||||
|
@ -21,7 +21,6 @@ import net.mamoe.mirai.message.FriendMessageEvent
|
||||
import net.mamoe.mirai.message.GroupMessageEvent
|
||||
import net.mamoe.mirai.message.MessageEvent
|
||||
import net.mamoe.mirai.message.TempMessageEvent
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
@ -211,7 +210,6 @@ fun <R> Bot.subscribeFriendMessages(
|
||||
*
|
||||
* @see CoroutineScope.incoming 打开一个指定事件的接收通道
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun <R> Bot.subscribeTempMessages(
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
|
@ -206,7 +206,6 @@ inline fun <reified E : Event> CoroutineScope.subscribe(
|
||||
*
|
||||
* @see CoroutineScope.subscribe
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun <E : Event> CoroutineScope.subscribe(
|
||||
eventClass: KClass<E>,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
@ -238,7 +237,6 @@ inline fun <reified E : Event> CoroutineScope.subscribeAlways(
|
||||
/**
|
||||
* @see CoroutineScope.subscribeAlways
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun <E : Event> CoroutineScope.subscribeAlways(
|
||||
eventClass: KClass<E>,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
@ -271,7 +269,6 @@ inline fun <reified E : Event> CoroutineScope.subscribeOnce(
|
||||
/**
|
||||
* @see CoroutineScope.subscribeOnce
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun <E : Event> CoroutineScope.subscribeOnce(
|
||||
eventClass: KClass<E>,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
@ -308,7 +305,6 @@ inline fun <reified E : BotEvent> Bot.subscribe(
|
||||
*
|
||||
* @see Bot.subscribe
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun <E : BotEvent> Bot.subscribe(
|
||||
eventClass: KClass<E>,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
@ -345,7 +341,6 @@ inline fun <reified E : BotEvent> Bot.subscribeAlways(
|
||||
*
|
||||
* @see Bot.subscribeAlways
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun <E : BotEvent> Bot.subscribeAlways(
|
||||
eventClass: KClass<E>,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
@ -376,7 +371,6 @@ inline fun <reified E : BotEvent> Bot.subscribeOnce(
|
||||
*
|
||||
* @see Bot.subscribeOnce
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun <E : BotEvent> Bot.subscribeOnce(
|
||||
eventClass: KClass<E>,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||
|
@ -14,7 +14,6 @@ import net.mamoe.mirai.contact.Friend
|
||||
import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.data.*
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import net.mamoe.mirai.utils.WeakRef
|
||||
|
||||
/**
|
||||
@ -73,7 +72,6 @@ interface LowLevelBotAPIAccessor {
|
||||
* 获取群公告列表
|
||||
* @param page 页码
|
||||
*/
|
||||
@SinceMirai("0.28.0")
|
||||
@LowLevelAPI
|
||||
@MiraiExperimentalAPI
|
||||
suspend fun _lowLevelGetAnnouncements(groupId: Long, page: Int = 1, amount: Int = 10): GroupAnnouncementList
|
||||
@ -83,7 +81,6 @@ interface LowLevelBotAPIAccessor {
|
||||
*
|
||||
* @return 公告的fid
|
||||
*/
|
||||
@SinceMirai("0.28.0")
|
||||
@LowLevelAPI
|
||||
@MiraiExperimentalAPI
|
||||
suspend fun _lowLevelSendAnnouncement(groupId: Long, announcement: GroupAnnouncement): String
|
||||
@ -93,7 +90,6 @@ interface LowLevelBotAPIAccessor {
|
||||
* 删除群公告
|
||||
* @param fid [GroupAnnouncement.fid]
|
||||
*/
|
||||
@SinceMirai("0.28.0")
|
||||
@LowLevelAPI
|
||||
@MiraiExperimentalAPI
|
||||
suspend fun _lowLevelDeleteAnnouncement(groupId: Long, fid: String)
|
||||
@ -102,7 +98,6 @@ interface LowLevelBotAPIAccessor {
|
||||
* 获取一条群公告
|
||||
* @param fid [GroupAnnouncement.fid]
|
||||
*/
|
||||
@SinceMirai("0.28.0")
|
||||
@LowLevelAPI
|
||||
@MiraiExperimentalAPI
|
||||
suspend fun _lowLevelGetAnnouncement(groupId: Long, fid: String): GroupAnnouncement
|
||||
@ -111,7 +106,6 @@ interface LowLevelBotAPIAccessor {
|
||||
/**
|
||||
* 获取群活跃信息
|
||||
*/
|
||||
@SinceMirai("0.29.0")
|
||||
@LowLevelAPI
|
||||
@MiraiExperimentalAPI
|
||||
suspend fun _lowLevelGetGroupActiveData(groupId: Long): GroupActiveData
|
||||
|
@ -44,7 +44,6 @@ import kotlin.jvm.JvmSynthetic
|
||||
* @see isContextIdenticalWith 判断语境是否相同
|
||||
*/
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@SinceMirai("0.32.0")
|
||||
abstract class MessageEvent : @PlannedRemoval("1.2.0") ContactMessage(),
|
||||
BotEvent, MessageEventExtensions<User, Contact> {
|
||||
|
||||
@ -77,7 +76,6 @@ abstract class MessageEvent : @PlannedRemoval("1.2.0") ContactMessage(),
|
||||
abstract override val message: MessageChain
|
||||
|
||||
/** 消息发送时间 (由服务器提供) */
|
||||
@SinceMirai("0.39.0")
|
||||
abstract val time: Int
|
||||
|
||||
/** 消息源 */
|
||||
|
@ -11,14 +11,12 @@ import net.mamoe.mirai.message.data.MessageChain
|
||||
import net.mamoe.mirai.message.data.MessageSource
|
||||
import net.mamoe.mirai.message.data.OnlineMessageSource
|
||||
import net.mamoe.mirai.message.data.source
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
|
||||
/**
|
||||
* 机器人收到的群临时会话消息的事件
|
||||
*
|
||||
* @see MessageEvent
|
||||
*/
|
||||
@SinceMirai("0.35.0")
|
||||
class TempMessageEvent(
|
||||
override val sender: Member,
|
||||
override val message: MessageChain,
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
package net.mamoe.mirai.message.data
|
||||
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
@ -28,8 +27,6 @@ private const val displayA = "@全体成员"
|
||||
object AtAll :
|
||||
Message.Key<AtAll>,
|
||||
MessageContent {
|
||||
|
||||
@SinceMirai("0.31.2")
|
||||
const val display = displayA
|
||||
override val typeName: String
|
||||
get() = "AtAll"
|
||||
|
@ -33,7 +33,6 @@ import net.mamoe.mirai.utils.*
|
||||
*
|
||||
* @see CustomMessageMetadata 自定义消息元数据
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
@MiraiExperimentalAPI
|
||||
sealed class CustomMessage : SingleMessage {
|
||||
/**
|
||||
@ -181,7 +180,6 @@ sealed class CustomMessage : SingleMessage {
|
||||
* @see CustomMessage 查看更多信息
|
||||
* @see ConstrainSingle 可实现此接口以保证消息链中只存在一个元素
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
@MiraiExperimentalAPI
|
||||
abstract class CustomMessageMetadata : CustomMessage(), MessageMetadata {
|
||||
companion object Key : Message.Key<CustomMessageMetadata> {
|
||||
|
@ -19,7 +19,6 @@ import net.mamoe.mirai.contact.nameCardOrNick
|
||||
import net.mamoe.mirai.message.MessageEvent
|
||||
import net.mamoe.mirai.message.data.ForwardMessage.DisplayStrategy
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import net.mamoe.mirai.utils.currentTimeSeconds
|
||||
import kotlin.jvm.JvmOverloads
|
||||
import kotlin.jvm.JvmSynthetic
|
||||
@ -79,7 +78,6 @@ import kotlin.jvm.JvmSynthetic
|
||||
*
|
||||
* @see buildForwardMessage
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
class ForwardMessage @JvmOverloads constructor(
|
||||
/**
|
||||
* 消息列表
|
||||
@ -187,7 +185,6 @@ class ForwardMessage @JvmOverloads constructor(
|
||||
/**
|
||||
* 转换为 [ForwardMessage]
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmOverloads
|
||||
fun Iterable<MessageEvent>.toForwardMessage(displayStrategy: DisplayStrategy = DisplayStrategy): ForwardMessage {
|
||||
val iterator = this.iterator()
|
||||
@ -208,7 +205,6 @@ fun Message.toForwardMessage(
|
||||
/**
|
||||
* 转换为 [ForwardMessage]
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmOverloads
|
||||
fun Message.toForwardMessage(
|
||||
senderId: Long,
|
||||
@ -223,7 +219,6 @@ fun Message.toForwardMessage(
|
||||
* @see ForwardMessageBuilder 查看 DSL 帮助
|
||||
* @see ForwardMessage 查看转发消息说明
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmSynthetic
|
||||
inline fun buildForwardMessage(
|
||||
context: Contact,
|
||||
@ -237,7 +232,6 @@ inline fun buildForwardMessage(
|
||||
* @see ForwardMessageBuilder 查看 DSL 帮助
|
||||
* @see ForwardMessage 查看转发消息说明
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmSynthetic
|
||||
inline fun MessageEvent.buildForwardMessage(
|
||||
context: Contact = this.subject,
|
||||
@ -250,7 +244,6 @@ inline fun MessageEvent.buildForwardMessage(
|
||||
/**
|
||||
* 标记转发消息 DSL
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
|
||||
@DslMarker
|
||||
annotation class ForwardMessageDsl
|
||||
@ -314,7 +307,6 @@ annotation class ForwardMessageDsl
|
||||
*
|
||||
* `S named "name1" named "name2" says M` 最终的发送人名称为 `"name2"`
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
class ForwardMessageBuilder private constructor(
|
||||
/**
|
||||
* 消息语境. 可为 [Group] 或 [User]
|
||||
|
@ -17,7 +17,6 @@ import net.mamoe.mirai.message.data.PokeMessage.Types
|
||||
import net.mamoe.mirai.message.data.VipFace.Companion
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.jvm.*
|
||||
|
||||
/**
|
||||
@ -26,7 +25,6 @@ import kotlin.jvm.*
|
||||
* @see PokeMessage 戳一戳
|
||||
* @see FlashImage 闪照
|
||||
*/
|
||||
@SinceMirai("0.31.0")
|
||||
sealed class HummerMessage : MessageContent {
|
||||
companion object Key : Message.Key<HummerMessage> {
|
||||
override val typeName: String
|
||||
@ -44,7 +42,6 @@ sealed class HummerMessage : MessageContent {
|
||||
*
|
||||
* @see Types 使用伴生对象中的常量
|
||||
*/
|
||||
@SinceMirai("0.31.0")
|
||||
@OptIn(MiraiInternalAPI::class)
|
||||
data class PokeMessage internal constructor(
|
||||
/**
|
||||
@ -158,7 +155,6 @@ data class PokeMessage internal constructor(
|
||||
*
|
||||
* @see Types 使用伴生对象中的常量
|
||||
*/
|
||||
@SinceMirai("0.39.5")
|
||||
@OptIn(MiraiInternalAPI::class)
|
||||
data class VipFace internal constructor(
|
||||
/**
|
||||
@ -241,7 +237,6 @@ data class VipFace internal constructor(
|
||||
*
|
||||
* @see Image 查看图片相关信息
|
||||
*/
|
||||
@SinceMirai("0.33.0")
|
||||
sealed class FlashImage : MessageContent, HummerMessage() {
|
||||
companion object Key : Message.Key<FlashImage> {
|
||||
/**
|
||||
@ -289,22 +284,17 @@ sealed class FlashImage : MessageContent, HummerMessage() {
|
||||
override fun toString(): String = stringValue!!
|
||||
override fun contentToString(): String = "[闪照]"
|
||||
}
|
||||
|
||||
@SinceMirai("0.33.0")
|
||||
inline fun Image.flash(): FlashImage = FlashImage(this)
|
||||
|
||||
@JvmSynthetic
|
||||
@SinceMirai("0.33.0")
|
||||
inline fun GroupImage.flash(): GroupFlashImage = FlashImage(this) as GroupFlashImage
|
||||
|
||||
@JvmSynthetic
|
||||
@SinceMirai("0.33.0")
|
||||
inline fun FriendImage.flash(): FriendFlashImage = FlashImage(this) as FriendFlashImage
|
||||
|
||||
/**
|
||||
* @see FlashImage.invoke
|
||||
*/
|
||||
@SinceMirai("0.33.0")
|
||||
data class GroupFlashImage(override val image: GroupImage) : FlashImage() {
|
||||
companion object Key : Message.Key<GroupFlashImage> {
|
||||
override val typeName: String
|
||||
@ -315,7 +305,6 @@ data class GroupFlashImage(override val image: GroupImage) : FlashImage() {
|
||||
/**
|
||||
* @see FlashImage.invoke
|
||||
*/
|
||||
@SinceMirai("0.33.0")
|
||||
data class FriendFlashImage(override val image: FriendImage) : FlashImage() {
|
||||
companion object Key : Message.Key<FriendFlashImage> {
|
||||
override val typeName: String
|
||||
|
@ -22,7 +22,6 @@ import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.utils.ExternalImage
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.PlannedRemoval
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.js.JsName
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
@ -114,7 +113,6 @@ sealed class GroupImage : AbstractImage() {
|
||||
* 在 Java 使用: `MessageUtils.calculateImageMd5(image)`
|
||||
*/
|
||||
@get:JvmName("calculateImageMd5")
|
||||
@SinceMirai("0.39.0")
|
||||
val Image.md5: ByteArray
|
||||
get() = calculateImageMd5ByImageId(imageId)
|
||||
|
||||
@ -139,7 +137,6 @@ sealed class FriendImage : AbstractImage() {
|
||||
* `/f8f1ab55-bf8e-4236-b55e-955848d7069f`
|
||||
* @see FRIEND_IMAGE_ID_REGEX_2
|
||||
*/
|
||||
@SinceMirai("0.39.2")
|
||||
// Java: MessageUtils.FRIEND_IMAGE_ID_REGEX_1
|
||||
val FRIEND_IMAGE_ID_REGEX_1 = Regex("""/[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}""")
|
||||
|
||||
@ -149,7 +146,6 @@ val FRIEND_IMAGE_ID_REGEX_1 = Regex("""/[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a
|
||||
* `/000000000-3814297509-BFB7027B9354B8F899A062061D74E206`
|
||||
* @see FRIEND_IMAGE_ID_REGEX_1
|
||||
*/
|
||||
@SinceMirai("0.39.2")
|
||||
// Java: MessageUtils.FRIEND_IMAGE_ID_REGEX_2
|
||||
val FRIEND_IMAGE_ID_REGEX_2 = Regex("""/[0-9]*-[0-9]*-[0-9a-fA-F]{32}""")
|
||||
|
||||
@ -159,7 +155,6 @@ val FRIEND_IMAGE_ID_REGEX_2 = Regex("""/[0-9]*-[0-9]*-[0-9a-fA-F]{32}""")
|
||||
* `{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai`
|
||||
*/
|
||||
@Suppress("RegExpRedundantEscape") // This is required on Android
|
||||
@SinceMirai("0.39.2")
|
||||
// Java: MessageUtils.GROUP_IMAGE_ID_REGEX
|
||||
val GROUP_IMAGE_ID_REGEX = Regex("""\{[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\}\.mirai""")
|
||||
|
||||
|
@ -99,7 +99,6 @@ interface Message { // must be interface. Don't consider any changes.
|
||||
/**
|
||||
* 此 [Key] 指代的 [Message] 类型名. 一般为 `class.simpleName`, 如 "QuoteReply", "PlainText"
|
||||
*/
|
||||
@SinceMirai("0.34.0")
|
||||
val typeName: String
|
||||
}
|
||||
|
||||
@ -122,7 +121,6 @@ interface Message { // must be interface. Don't consider any changes.
|
||||
*
|
||||
* @see plus `+` 操作符重载
|
||||
*/
|
||||
@SinceMirai("0.34.0")
|
||||
@JvmSynthetic // in java they should use `plus` instead
|
||||
fun followedBy(tail: Message): MessageChain = followedByImpl(tail)
|
||||
|
||||
@ -155,7 +153,6 @@ interface Message { // must be interface. Don't consider any changes.
|
||||
*
|
||||
* @see toString 得到包含 mirai 消息元素代码的, 易读的字符串
|
||||
*/
|
||||
@SinceMirai("0.34.0")
|
||||
fun contentToString(): String
|
||||
|
||||
|
||||
@ -168,7 +165,6 @@ interface Message { // must be interface. Don't consider any changes.
|
||||
*
|
||||
* @sample net.mamoe.mirai.message.data.ContentEqualsTest
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun contentEquals(another: Message, ignoreCase: Boolean = false): Boolean = contentEqualsImpl(another, ignoreCase)
|
||||
|
||||
/**
|
||||
@ -180,7 +176,6 @@ interface Message { // must be interface. Don't consider any changes.
|
||||
*
|
||||
* @sample net.mamoe.mirai.message.data.ContentEqualsTest
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun contentEquals(another: String, ignoreCase: Boolean = false): Boolean {
|
||||
if (!this.contentToString().equals(another, ignoreCase = ignoreCase)) return false
|
||||
return when (this) {
|
||||
@ -217,15 +212,12 @@ inline val Message.content: String get() = contentToString()
|
||||
* - [PlainText] 长度为 0
|
||||
* - [MessageChain] 所有元素都满足 [isContentEmpty]
|
||||
*/
|
||||
@SinceMirai("0.39.3")
|
||||
fun Message.isContentEmpty(): Boolean = when (this) {
|
||||
is MessageMetadata -> true
|
||||
is PlainText -> this.content.isEmpty()
|
||||
is MessageChain -> this.all { it.isContentEmpty() }
|
||||
else -> false
|
||||
}
|
||||
|
||||
@SinceMirai("0.39.3")
|
||||
inline fun Message.isContentNotEmpty(): Boolean = !this.isContentEmpty()
|
||||
|
||||
inline fun Message.isPlain(): Boolean = this is PlainText
|
||||
@ -291,7 +283,6 @@ interface MessageMetadata : SingleMessage
|
||||
*
|
||||
* 实现此接口的元素将会在连接时自动处理替换.
|
||||
*/
|
||||
@SinceMirai("0.34.0")
|
||||
interface ConstrainSingle<out M : Message> : MessageMetadata {
|
||||
val key: Key<M>
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ package net.mamoe.mirai.message.data
|
||||
import net.mamoe.mirai.JavaFriendlyAPI
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.js.JsName
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
@ -44,7 +43,6 @@ interface MessageChain : Message, Iterable<SingleMessage> {
|
||||
/**
|
||||
* 元素数量. [EmptyMessageChain] 不参加计数.
|
||||
*/
|
||||
@SinceMirai("0.31.1")
|
||||
val size: Int
|
||||
|
||||
/**
|
||||
@ -96,7 +94,6 @@ interface MessageChain : Message, Iterable<SingleMessage> {
|
||||
/**
|
||||
* 遍历每一个 [消息内容][MessageContent]
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmSynthetic
|
||||
inline fun MessageChain.forEachContent(block: (MessageContent) -> Unit) {
|
||||
for (element in this) {
|
||||
|
@ -14,7 +14,6 @@
|
||||
package net.mamoe.mirai.message.data
|
||||
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
import kotlin.jvm.JvmSynthetic
|
||||
@ -159,7 +158,6 @@ open class MessageChainBuilder private constructor(
|
||||
/**
|
||||
* 将所有已有元素引用复制到一个新的 [MessageChainBuilder]
|
||||
*/
|
||||
@SinceMirai("0.38.0")
|
||||
fun copy(): MessageChainBuilder {
|
||||
return MessageChainBuilder(container.toMutableList())
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import net.mamoe.mirai.recallIn
|
||||
import net.mamoe.mirai.utils.LazyProperty
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
@ -60,7 +59,6 @@ import kotlin.jvm.JvmSynthetic
|
||||
* @see OfflineMessageSource 离线消息的 [MessageSource]
|
||||
*/
|
||||
@OptIn(MiraiExperimentalAPI::class)
|
||||
@SinceMirai("0.33.0")
|
||||
sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<MessageSource> {
|
||||
companion object Key : Message.Key<MessageSource> {
|
||||
override val typeName: String get() = "MessageSource"
|
||||
@ -96,7 +94,6 @@ sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<MessageSo
|
||||
*
|
||||
* 在事件中和在引用中无法保证同一条消息的 [internalId] 相同.
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
abstract val internalId: Int
|
||||
|
||||
/**
|
||||
@ -167,7 +164,6 @@ sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<MessageSo
|
||||
*
|
||||
* @see OnlineMessageSource.toOffline 转为 [OfflineMessageSource]
|
||||
*/
|
||||
@SinceMirai("0.33.0")
|
||||
@OptIn(MiraiExperimentalAPI::class)
|
||||
sealed class OnlineMessageSource : MessageSource() {
|
||||
companion object Key : Message.Key<OnlineMessageSource> {
|
||||
@ -291,7 +287,6 @@ sealed class OnlineMessageSource : MessageSource() {
|
||||
*
|
||||
* @see buildMessageSource 构建一个 [OfflineMessageSource]
|
||||
*/
|
||||
@SinceMirai("0.33.0")
|
||||
abstract class OfflineMessageSource : MessageSource() {
|
||||
companion object Key : Message.Key<OfflineMessageSource> {
|
||||
override val typeName: String
|
||||
@ -301,8 +296,6 @@ abstract class OfflineMessageSource : MessageSource() {
|
||||
enum class Kind {
|
||||
GROUP,
|
||||
FRIEND,
|
||||
|
||||
@SinceMirai("0.36.0")
|
||||
TEMP
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ import net.mamoe.mirai.contact.Friend
|
||||
import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.contact.Member
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import net.mamoe.mirai.utils.currentTimeSeconds
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
@ -28,7 +27,6 @@ import kotlin.jvm.JvmSynthetic
|
||||
/**
|
||||
* 将在线消息源转换为离线消息源.
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmName("toOfflineMessageSource")
|
||||
fun OnlineMessageSource.toOffline(): OfflineMessageSource =
|
||||
OfflineMessageSourceByOnline(this)
|
||||
@ -44,7 +42,6 @@ fun OnlineMessageSource.toOffline(): OfflineMessageSource =
|
||||
* @see buildMessageSource 查看更多说明
|
||||
*/
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmName("copySource")
|
||||
fun MessageSource.copyAmend(
|
||||
block: MessageSourceAmender.() -> Unit
|
||||
@ -53,7 +50,6 @@ fun MessageSource.copyAmend(
|
||||
/**
|
||||
* 仅于 [copyAmend] 中修改 [MessageSource]
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
interface MessageSourceAmender {
|
||||
var kind: OfflineMessageSource.Kind
|
||||
var fromUin: Long
|
||||
@ -65,7 +61,6 @@ interface MessageSourceAmender {
|
||||
var originalMessage: MessageChain
|
||||
|
||||
/** 从另一个 [MessageSource] 中复制 [id], [internalId], [time]*/
|
||||
@SinceMirai("0.39.2")
|
||||
fun metadataFrom(another: MessageSource) {
|
||||
this.id = another.id
|
||||
this.internalId = another.internalId
|
||||
@ -107,7 +102,6 @@ interface MessageSourceAmender {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
@SinceMirai("0.39.0")
|
||||
@JvmSynthetic
|
||||
@MiraiExperimentalAPI
|
||||
fun Bot.buildMessageSource(block: MessageSourceBuilder.() -> Unit): MessageSource {
|
||||
|
@ -16,7 +16,6 @@ package net.mamoe.mirai.message.data
|
||||
import kotlinx.coroutines.Job
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
@ -43,7 +42,6 @@ import kotlin.jvm.JvmSynthetic
|
||||
* @see MessageSource 获取有关消息源的更多信息
|
||||
*/
|
||||
@OptIn(MiraiExperimentalAPI::class)
|
||||
@SinceMirai("0.33.0")
|
||||
class QuoteReply(val source: MessageSource) : Message, MessageMetadata, ConstrainSingle<QuoteReply> {
|
||||
companion object Key : Message.Key<QuoteReply> {
|
||||
override val typeName: String
|
||||
@ -68,7 +66,6 @@ inline val QuoteReply.id: Int
|
||||
/**
|
||||
* @see MessageSource.internalId
|
||||
*/
|
||||
@SinceMirai("0.39.2")
|
||||
@get:JvmSynthetic
|
||||
inline val QuoteReply.internalId: Int
|
||||
get() = source.internalId
|
||||
|
@ -14,7 +14,6 @@
|
||||
package net.mamoe.mirai.message.data
|
||||
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
@ -30,7 +29,6 @@ import kotlin.jvm.JvmSynthetic
|
||||
* @see LightApp 小程序 (JSON)
|
||||
*/
|
||||
// not using sealed class for customized implementations
|
||||
@SinceMirai("0.27.0")
|
||||
interface RichMessage : MessageContent {
|
||||
|
||||
/**
|
||||
@ -49,14 +47,12 @@ interface RichMessage : MessageContent {
|
||||
* @suppress 此 API 不稳定, 可能在任意时刻被删除
|
||||
*/
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("0.30.0")
|
||||
companion object Templates : Message.Key<RichMessage> {
|
||||
|
||||
/**
|
||||
* @suppress 此 API 不稳定, 可能在任意时刻被删除
|
||||
*/
|
||||
@MiraiExperimentalAPI
|
||||
@SinceMirai("0.30.0")
|
||||
fun share(
|
||||
url: String,
|
||||
title: String? = null,
|
||||
@ -97,7 +93,6 @@ interface RichMessage : MessageContent {
|
||||
*
|
||||
* @see ServiceMessage 服务消息
|
||||
*/
|
||||
@SinceMirai("0.27.0")
|
||||
data class LightApp(override val content: String) : RichMessage {
|
||||
companion object Key : Message.Key<LightApp> {
|
||||
override val typeName: String get() = "LightApp"
|
||||
@ -116,7 +111,6 @@ data class LightApp(override val content: String) : RichMessage {
|
||||
*
|
||||
* @see LightApp 小程序类型消息
|
||||
*/
|
||||
@SinceMirai("0.37.3")
|
||||
open class ServiceMessage(val serviceId: Int, final override val content: String) : RichMessage {
|
||||
companion object Key : Message.Key<ServiceMessage> {
|
||||
override val typeName: String get() = "ServiceMessage"
|
||||
@ -153,7 +147,6 @@ commonElem=CommonElem#750141174 {
|
||||
*/
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@JvmSynthetic
|
||||
@SinceMirai("0.27.0")
|
||||
@MiraiExperimentalAPI
|
||||
inline fun buildXmlMessage(serviceId: Int, block: @XmlMessageDsl XmlMessageBuilder.() -> Unit): ServiceMessage =
|
||||
ServiceMessage(serviceId, XmlMessageBuilder().apply(block).text)
|
||||
@ -205,8 +198,6 @@ class XmlMessageBuilder(
|
||||
sourceName = name
|
||||
sourceIconURL = iconURL
|
||||
}
|
||||
|
||||
@SinceMirai("0.27.0")
|
||||
@XmlMessageDsl
|
||||
class ItemBuilder @PublishedApi internal constructor(
|
||||
var bg: Int = 0,
|
||||
@ -229,9 +220,6 @@ class XmlMessageBuilder(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SinceMirai("0.31.0")
|
||||
@MiraiExperimentalAPI
|
||||
internal class LongMessage internal constructor(content: String, val resId: String) : ServiceMessage(35, content) {
|
||||
companion object Key : Message.Key<LongMessage> {
|
||||
@ -240,5 +228,4 @@ internal class LongMessage internal constructor(content: String, val resId: Stri
|
||||
}
|
||||
|
||||
@OptIn(MiraiExperimentalAPI::class)
|
||||
@SinceMirai("0.39.0")
|
||||
internal class ForwardMessageInternal(content: String) : ServiceMessage(35, content)
|
@ -144,13 +144,9 @@ open class BotConfiguration {
|
||||
* ```
|
||||
*/
|
||||
@ConfigurationDsl
|
||||
@SinceMirai("0.38.0")
|
||||
suspend fun inheritCoroutineContext() {
|
||||
parentCoroutineContext = coroutineContext
|
||||
}
|
||||
|
||||
|
||||
@SinceMirai("0.38.0")
|
||||
@DslMarker
|
||||
annotation class ConfigurationDsl
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ inline operator fun <T> UnsafeSoftRef<T>.getValue(thisRef: Any?, property: KProp
|
||||
* @see softRef provides a SoftRef
|
||||
* @see unsafeSoftRef provides a UnsafeSoftRef
|
||||
*/
|
||||
@SinceMirai("0.32.0")
|
||||
expect class SoftRef<T>(referent: T) {
|
||||
fun get(): T?
|
||||
fun clear()
|
||||
|
@ -20,7 +20,6 @@ import javax.swing.JTextField
|
||||
/**
|
||||
* @author Karlatemp <karlatemp@vip.qq.com> <https://github.com/Karlatemp>
|
||||
*/
|
||||
@SinceMirai("0.39.2")
|
||||
@MiraiExperimentalAPI
|
||||
object SwingSolver : LoginSolver() {
|
||||
override suspend fun onSolvePicCaptcha(bot: Bot, data: ByteArray): String? {
|
||||
|
Loading…
Reference in New Issue
Block a user