diff --git a/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt b/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt index 3f68bc8..fac2f7c 100644 --- a/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt +++ b/simbot-component-onebot-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/common/OneBot.kt @@ -17,12 +17,12 @@ package love.forte.simbot.component.onebot.common -import love.forte.simbot.annotations.InternalSimbotAPI +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI /** * An OneBot object. */ -@InternalSimbotAPI +@InternalOneBotAPI public object OneBot // TODO 一些Opt注解放在这个模块? diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt index 9deb65c..1132b31 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-common/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/common/utils/AvatarUtil.kt @@ -19,7 +19,7 @@ package love.forte.simbot.component.onebot.v11.common.utils -import love.forte.simbot.annotations.InternalSimbotAPI +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI import kotlin.jvm.JvmName /** @@ -27,7 +27,7 @@ import kotlin.jvm.JvmName * * @param id QQ号 */ -@InternalSimbotAPI +@InternalOneBotAPI public fun qqAvatar640(id: String): String = "https://q1.qlogo.cn/g?b=qq&nk=$id&s=640" @@ -36,6 +36,6 @@ public fun qqAvatar640(id: String): String = * * @param id QQ号 */ -@InternalSimbotAPI +@InternalOneBotAPI public fun qqAvatar100(id: String): String = "https://q1.qlogo.cn/g?b=qq&nk=$id&s=100" diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt index 8c931f8..015eb75 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/api/OneBotApiRequests.kt @@ -28,8 +28,8 @@ import io.ktor.client.statement.* import io.ktor.http.* import io.ktor.http.content.* import io.ktor.utils.io.charsets.* -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.common.serialization.guessSerializer +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI import love.forte.simbot.component.onebot.v11.core.OneBot11 import love.forte.simbot.logger.Logger import love.forte.simbot.logger.LoggerFactory @@ -41,7 +41,7 @@ import kotlin.jvm.JvmSynthetic /** * 用于在对 [OneBotApi] 发起请求时或得到想用后输出相关日志日志收集器。 */ -@InternalSimbotAPI +@InternalOneBotAPI public val ApiLogger: Logger = LoggerFactory.getLogger("love.forte.simbot.component.onebot.v11.core.api.API") /** diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt index 0dc74be..646699a 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/OneBotBotSerializableConfiguration.kt @@ -17,11 +17,11 @@ package love.forte.simbot.component.onebot.v11.core.bot -import io.ktor.http.Url +import io.ktor.http.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.bot.SerializableBotConfiguration +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI import love.forte.simbot.component.onebot.v11.core.component.OneBot11Component @@ -33,7 +33,7 @@ import love.forte.simbot.component.onebot.v11.core.component.OneBot11Component * * @author ForteScarlet */ -@InternalSimbotAPI +@InternalOneBotAPI @Serializable @SerialName(OneBot11Component.ID_VALUE) public data class OneBotBotSerializableConfiguration( diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt index 3731709..e403407 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-event/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/event/Event.kt @@ -17,8 +17,8 @@ package love.forte.simbot.component.onebot.v11.event -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI /** @@ -98,7 +98,7 @@ public interface Event { * */ @Retention(AnnotationRetention.SOURCE) -@InternalSimbotAPI +@InternalOneBotAPI public annotation class ExpectEventType(val postType: String, val subType: String) /** @@ -109,5 +109,5 @@ public annotation class ExpectEventType(val postType: String, val subType: Strin * @suppress 用于项目内部代码生成器 */ @Retention(AnnotationRetention.SOURCE) -@InternalSimbotAPI +@InternalOneBotAPI public annotation class ExpectEventSubTypeProperty(val value: String, val postType: String, val name: String) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts index c1cf926..6074747 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/build.gradle.kts @@ -21,6 +21,7 @@ import love.forte.gradle.common.kotlin.multiplatform.applyTier1 import love.forte.gradle.common.kotlin.multiplatform.applyTier2 import love.forte.gradle.common.kotlin.multiplatform.applyTier3 import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi plugins { kotlin("multiplatform") @@ -38,6 +39,13 @@ kotlin { explicitApi() applyDefaultHierarchyTemplate() + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + optIn.addAll( + "love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI" + ) + } + configKotlinJvm() js(IR) { @@ -50,6 +58,7 @@ kotlin { sourceSets { commonMain.dependencies { + implementation(project(":simbot-component-onebot-common")) implementation(libs.simbot.api) implementation(libs.simbot.common.annotations) api(libs.kotlinx.coroutines.core) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt index 6812a96..e343486 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/MessageElementResolvers.kt @@ -20,27 +20,12 @@ package love.forte.simbot.component.onebot.v11.message import kotlinx.coroutines.suspendCancellableCoroutine -import love.forte.simbot.annotations.InternalSimbotAPI import love.forte.simbot.common.id.StringID.Companion.ID import love.forte.simbot.common.id.literal -import love.forte.simbot.component.onebot.v11.message.segment.OneBotAt -import love.forte.simbot.component.onebot.v11.message.segment.OneBotFace -import love.forte.simbot.component.onebot.v11.message.segment.OneBotImage -import love.forte.simbot.component.onebot.v11.message.segment.OneBotMessageSegment -import love.forte.simbot.component.onebot.v11.message.segment.OneBotMessageSegmentElement -import love.forte.simbot.component.onebot.v11.message.segment.OneBotText -import love.forte.simbot.component.onebot.v11.message.segment.toElement -import love.forte.simbot.message.At -import love.forte.simbot.message.AtAll -import love.forte.simbot.message.Face -import love.forte.simbot.message.Image -import love.forte.simbot.message.Message -import love.forte.simbot.message.Messages -import love.forte.simbot.message.OfflineImage +import love.forte.simbot.component.onebot.common.annotations.InternalOneBotAPI +import love.forte.simbot.component.onebot.v11.message.segment.* +import love.forte.simbot.message.* import love.forte.simbot.message.OfflineImageResolver.Companion.resolve -import love.forte.simbot.message.OfflineImageValueResolver -import love.forte.simbot.message.RemoteImage -import love.forte.simbot.message.Text import love.forte.simbot.resource.Resource import love.forte.simbot.resource.toResource import love.forte.simbot.resource.toStringResource @@ -57,7 +42,7 @@ import kotlin.jvm.JvmName * | [OneBotFace] | [Face] | * | 其他 | 使用 [toElement] 转化 | */ -@InternalSimbotAPI +@InternalOneBotAPI public fun OneBotMessageSegment.resolveToMessageElement(): Message.Element { return when (this) { is OneBotAt -> if (isAll) AtAll else At(data.qq.ID) @@ -71,7 +56,7 @@ public fun OneBotMessageSegment.resolveToMessageElement(): Message.Element { * * @see resolveToOneBotSegment */ -@InternalSimbotAPI +@InternalOneBotAPI public suspend fun Message.resolveToOneBotSegmentList(): List { return when (this) { is Message.Element -> resolveToOneBotSegment() @@ -85,7 +70,7 @@ public suspend fun Message.resolveToOneBotSegmentList(): List