diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt index 8e1545a3d..93de5cd74 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt @@ -10,21 +10,33 @@ package net.mamoe.mirai.contact import net.mamoe.mirai.Bot -import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.utils.SinceMirai /** * 拥有 [id] 的对象. * 此为 [Contact] 与 [Bot] 的唯一公共接口. + * **注意:** 此接口为实验性接口, 将来可能会发生不兼容的更名. * * @see Contact * @see Bot */ -@MiraiExperimentalAPI("classname may change") -@SinceMirai("0.38.0") +@ExperimentalIdentification("classname may change") +@SinceMirai("0.37.2") interface Identified { /** * QQ 号或群号. */ val id: Long -} \ No newline at end of file +} + + +/** + * 标记使用实验性 [Identified] 接口. + */ +@Retention(AnnotationRetention.SOURCE) +@RequiresOptIn(level = RequiresOptIn.Level.WARNING) +@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS, AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.CONSTRUCTOR) +annotation class ExperimentalIdentification( + val message: String = "" +) \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt index e3f68069e..4190ce11c 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt @@ -75,7 +75,7 @@ sealed class BotOfflineEvent : BotEvent { /** * 服务器主动要求更换另一个服务器 */ - @SinceMirai("0.38.0") + @SinceMirai("0.37.1") data class RequireReconnect(override val bot: Bot) : BotOfflineEvent(), Packet, BotPassiveEvent } diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt index a63151f0e..ad4cb8d46 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt @@ -458,7 +458,7 @@ open class MessageSubscribersBuilder( /** 如果消息内容 `==` [equals] */ @MessageDsl - @SinceMirai("0.38.0") + @SinceMirai("0.37.1") operator fun String.invoke(block: MessageListener): Ret { return case(this, onEvent = block) } diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt index 0fbf2ef61..b4e492a40 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt @@ -117,12 +117,14 @@ sealed class OnlineMessageSource : MessageSource() { * 消息发送人. 可能为 [机器人][Bot] 或 [好友][QQ] 或 [群员][Member]. * 即类型必定为 [Bot], [QQ] 或 [Member] */ + @ExperimentalIdentification abstract val sender: Identified /** * 消息发送目标. 可能为 [机器人][Bot] 或 [好友][QQ] 或 [群][Group]. * 即类型必定为 [Bot], [QQ] 或 [Group] */ + @ExperimentalIdentification abstract val target: Identified /** @@ -134,6 +136,7 @@ sealed class OnlineMessageSource : MessageSource() { /** * 由 [机器人主动发送消息][Contact.sendMessage] 产生的 [MessageSource] */ + @OptIn(ExperimentalIdentification::class) sealed class Outgoing : OnlineMessageSource() { companion object Key : Message.Key { override val typeName: String get() = "OnlineMessageSource.Outgoing" @@ -179,6 +182,7 @@ sealed class OnlineMessageSource : MessageSource() { /** * 接收到的一条消息的 [MessageSource] */ + @OptIn(ExperimentalIdentification::class) sealed class Incoming : OnlineMessageSource() { companion object Key : Message.Key { override val typeName: String get() = "OnlineMessageSource.Incoming" @@ -240,6 +244,7 @@ sealed class OnlineMessageSource : MessageSource() { @Deprecated("for binary compatibility until 1.0.0", level = DeprecationLevel.HIDDEN) @get:JvmName("target") @get:JvmSynthetic + @OptIn(ExperimentalIdentification::class) open val target2: Any get() = target @@ -247,6 +252,7 @@ sealed class OnlineMessageSource : MessageSource() { @Deprecated("for binary compatibility until 1.0.0", level = DeprecationLevel.HIDDEN) @get:JvmName("sender") @get:JvmSynthetic + @OptIn(ExperimentalIdentification::class) open val sender2: Any get() = sender }