Commit 3c9b057a authored by Him188's avatar Him188

Rename `Identified` to `ContactOrBot`, remove experimental annotations

parent 15527b56
......@@ -50,7 +50,7 @@ suspend inline fun <B : Bot> 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] 实例列表.
......
......@@ -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].
*/
......
......@@ -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
......@@ -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]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment