From 6e99c0bb5e953d286abe4cc2279602269eff12c1 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Sun, 9 Jun 2024 23:37:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?pref:=20=E4=BC=98=E5=8C=96API=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=97=B6=E7=9A=84=E5=BC=82=E5=B8=B8=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=92=8C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onebot/v11/core/api/OneBotApiRequests.kt | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) 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..f628738 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 @@ -181,17 +181,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 } /** From 63a8c3239de2d7154abffd6dc23c37be587ece67 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Sun, 9 Jun 2024 23:38:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?pref:=20=E4=BC=98=E5=8C=96API=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=97=B6=E7=9A=84=E5=BC=82=E5=B8=B8=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=92=8C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/P.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 35b481d4cefd3fdd6d283d02168805e89a2a5923 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Sun, 9 Jun 2024 23:44:44 +0800 Subject: [PATCH 3/3] =?UTF-8?q?pref:=20=E7=A7=BB=E9=99=A4=E6=8E=89?= =?UTF-8?q?=E6=B2=A1=E5=BF=85=E8=A6=81=E7=9A=84=20`@JvmOverloads`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/onebot/v11/core/api/OneBotApiRequests.kt | 9 --------- 1 file changed, 9 deletions(-) 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 f628738..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, @@ -207,7 +203,6 @@ public suspend fun OneBotApi<*>.requestRaw( * */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi<*>.requestRaw( client: HttpClient, host: String, @@ -225,7 +220,6 @@ public suspend fun OneBotApi<*>.requestRaw( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestResult( client: HttpClient, host: Url, @@ -246,7 +240,6 @@ public suspend fun OneBotApi.requestResult( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestResult( client: HttpClient, host: String, @@ -266,7 +259,6 @@ public suspend fun OneBotApi.requestResult( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestData( client: HttpClient, host: Url, @@ -289,7 +281,6 @@ public suspend fun OneBotApi.requestData( * @see OneBotApi.request */ @JvmSynthetic -@JvmOverloads public suspend fun OneBotApi.requestData( client: HttpClient, host: String,