diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt index 17e4b589d..d00de4f3a 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt @@ -50,7 +50,7 @@ suspend inline fun B.alsoLogin(): B = also { login() } */ @Suppress("INAPPLICABLE_JVM_NAME") @OptIn(MiraiInternalAPI::class, LowLevelAPI::class) -abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(), Identified { +abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(), ContactOrBot { companion object { /** * 复制一份此时的 [Bot] 实例列表. diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt index d8e2dd40f..b4c98884f 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt @@ -8,6 +8,7 @@ */ @file:Suppress("EXPERIMENTAL_API_USAGE", "NOTHING_TO_INLINE", "EXPERIMENTAL_OVERRIDE") +@file:OptIn(MiraiInternalAPI::class, JavaFriendlyAPI::class) package net.mamoe.mirai.contact @@ -34,9 +35,8 @@ import kotlin.jvm.JvmSynthetic * 联系人. 虽然叫做联系人, 但他的子类有 [QQ], [群成员][Member] 和 [群][Group]. * * @author Him188moe - */ // 不要删除多平台结构 !!! kotlin bug -@OptIn(MiraiInternalAPI::class, JavaFriendlyAPI::class) -abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI(), Identified { + */ +abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI(), ContactOrBot { /** * 这个联系人所属 [Bot]. */ diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactOrBot.kt similarity index 61% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt rename to mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactOrBot.kt index 93de5cd74..c9ce94d7e 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactOrBot.kt @@ -20,23 +20,10 @@ import net.mamoe.mirai.utils.SinceMirai * @see Contact * @see Bot */ -@ExperimentalIdentification("classname may change") @SinceMirai("0.37.2") -interface Identified { +interface ContactOrBot { /** * QQ 号或群号. */ val id: Long -} - - -/** - * 标记使用实验性 [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 +} \ No newline at end of file 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 14dc797bb..291ca89c6 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,14 +117,14 @@ sealed class OnlineMessageSource : MessageSource() { * 即类型必定为 [Bot], [QQ] 或 [Member] */ @ExperimentalIdentification - abstract val sender: Identified + abstract val sender: ContactOrBot /** * 消息发送目标. 可能为 [机器人][Bot] 或 [好友][QQ] 或 [群][Group]. * 即类型必定为 [Bot], [QQ] 或 [Group] */ @ExperimentalIdentification - abstract val target: Identified + abstract val target: ContactOrBot /** * 消息主体. 群消息时为 [Group]. 好友消息时为 [QQ], 临时消息为 [Member]