diff --git a/buildSrc/src/main/kotlin/P.kt b/buildSrc/src/main/kotlin/P.kt index 3000091..7a9e60f 100644 --- a/buildSrc/src/main/kotlin/P.kt +++ b/buildSrc/src/main/kotlin/P.kt @@ -41,7 +41,7 @@ object P { override val homepage: String get() = HOMEPAGE - private val baseVersion = v(0, 1, 0) + private val baseVersion = v(0, 1, 1) val snapshotVersion = baseVersion - Version.SNAPSHOT override val version = if (isSnapshot()) snapshotVersion else baseVersion 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 015eb75..d7b93f6 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 @@ -35,7 +35,6 @@ import love.forte.simbot.logger.Logger import love.forte.simbot.logger.LoggerFactory import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName -import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmSynthetic /** @@ -64,7 +63,6 @@ public val ApiLogger: Logger = LoggerFactory.getLogger("love.forte.simbot.compon * @param actionSuffixes 会被拼接到 [OneBotApi.action] 的行为后缀,可参考 [OneBotApi.Actions]. */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi<*>.request( client: HttpClient, host: Url, @@ -153,7 +151,6 @@ public suspend fun OneBotApi<*>.request( * @param actionSuffixes 会被拼接到 [OneBotApi.action] 的行为后缀,可参考 [OneBotApi.Actions]. */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi<*>.request( client: HttpClient, host: String, @@ -171,7 +168,6 @@ public suspend fun OneBotApi<*>.request( * */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi<*>.requestRaw( client: HttpClient, host: Url, @@ -181,17 +177,20 @@ public suspend fun OneBotApi<*>.requestRaw( ): String { val response = request(client, host, accessToken, actionSuffixes) val status = response.status + val body = response.bodyAsText(charset) + if (!status.isSuccess()) { - throw OneBotApiResponseNotSuccessException(status) - } - return response.bodyAsText(charset).also { raw -> - ApiLogger.debug( - "API [{}] RES <=== {}, raw: {}", - action, - response.request.url, - raw - ) + throw OneBotApiResponseNotSuccessException(status, "status: $status, body: $body") } + + ApiLogger.debug( + "API [{}] RES <=== {}, body: {}", + action, + response.request.url, + body + ) + + return body } /** @@ -204,7 +203,6 @@ public suspend fun OneBotApi<*>.requestRaw( * */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi<*>.requestRaw( client: HttpClient, host: String, @@ -222,7 +220,6 @@ public suspend fun OneBotApi<*>.requestRaw( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestResult( client: HttpClient, host: Url, @@ -243,7 +240,6 @@ public suspend fun OneBotApi.requestResult( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestResult( client: HttpClient, host: String, @@ -263,7 +259,6 @@ public suspend fun OneBotApi.requestResult( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestData( client: HttpClient, host: Url, @@ -286,7 +281,6 @@ public suspend fun OneBotApi.requestData( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestData( client: HttpClient, host: String,