Skip to content

Release: v4.1.1 #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/v4.1.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
| 依赖 | 版本 |
| ---: | :--- |
| Kotlin | **v2.1.20** |
| simbot核心库 | [**v4.12.0**](https://github.com/simple-robot/simpler-robot/releases/tag/v4.12.0) |

我们欢迎并期望着您的 [反馈](https://github.com/simple-robot/simbot-component-kook/issues) 或 [协助](https://github.com/simple-robot/simbot-component-kook/pulls),感谢您的贡献与支持!
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v4.1.1

> Release & Pull Notes: [v4.1.1](https://github.com/simple-robot/simpler-robot/releases/tag/v4.1.1)

- fix(api): Fix api path of CreateInviteApi ([`796261a`](https://github.com/simple-robot/simpler-robot/commit/796261a))

# v4.1.0

> Release & Pull Notes: [v4.1.0](https://github.com/simple-robot/simpler-robot/releases/tag/v4.1.0)
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ object P : ProjectDetail() {
override val homepage: String
get() = HOMEPAGE

const val VERSION = "4.1.0"
const val NEXT_VERSION = "4.1.1"
const val VERSION = "4.1.1"
const val NEXT_VERSION = "4.1.2"

override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"
override val version = if (isSnapshot()) snapshotVersion else VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import changelog.generateChangelog


tasks.create("createChangelog") {
tasks.register("createChangelog") {
group = "documentation"
doFirst {
generateChangelog("v${P.version}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ public class CreateInviteApi private constructor(
) : KookPostApi<CreatedInvite>() {
public companion object Factory {
// /api/v3/invite/create POST
private val PATH = ApiPath.create("invite", "list")

// TODO Empty CreateInviteApi
private val EMPTY = CreateInviteApi()
private val PATH = ApiPath.create("invite", "create")

/**
* 通过 [服务器id][guildId] 构建一个 [创建邀请链接][CreateInviteApi] 实例。
Expand Down
28 changes: 24 additions & 4 deletions simbot-component-kook-core/api/simbot-component-kook-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -1346,8 +1346,6 @@ public final class love/forte/simbot/component/kook/message/KookCardMessage$Comp

public final class love/forte/simbot/component/kook/message/KookChannelMessageDetailsContent : love/forte/simbot/component/kook/message/KookMessageContent {
public static final field Companion Llove/forte/simbot/component/kook/message/KookChannelMessageDetailsContent$Companion;
public final fun copy (Llove/forte/simbot/kook/messages/ChannelMessageDetails;Llove/forte/simbot/component/kook/bot/KookBot;)Llove/forte/simbot/component/kook/message/KookChannelMessageDetailsContent;
public static synthetic fun copy$default (Llove/forte/simbot/component/kook/message/KookChannelMessageDetailsContent;Llove/forte/simbot/kook/messages/ChannelMessageDetails;Llove/forte/simbot/component/kook/bot/KookBot;ILjava/lang/Object;)Llove/forte/simbot/component/kook/message/KookChannelMessageDetailsContent;
public synthetic fun delete ([Llove/forte/simbot/ability/DeleteOption;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun equals (Ljava/lang/Object;)Z
public fun getId ()Llove/forte/simbot/common/id/ID;
Expand Down Expand Up @@ -1444,8 +1442,6 @@ public final class love/forte/simbot/component/kook/message/KookMessagesTransfor
public final class love/forte/simbot/component/kook/message/KookQuote : love/forte/simbot/message/MessageReference {
public static final field Companion Llove/forte/simbot/component/kook/message/KookQuote$Companion;
public final fun component1 ()Llove/forte/simbot/kook/objects/Quote;
public final fun copy (Llove/forte/simbot/kook/objects/Quote;)Llove/forte/simbot/component/kook/message/KookQuote;
public static synthetic fun copy$default (Llove/forte/simbot/component/kook/message/KookQuote;Llove/forte/simbot/kook/objects/Quote;ILjava/lang/Object;)Llove/forte/simbot/component/kook/message/KookQuote;
public static final fun create (Llove/forte/simbot/kook/objects/Quote;)Llove/forte/simbot/component/kook/message/KookQuote;
public fun equals (Ljava/lang/Object;)Z
public fun getId ()Llove/forte/simbot/common/id/ID;
Expand Down Expand Up @@ -1533,13 +1529,37 @@ public abstract interface class love/forte/simbot/component/kook/role/KookRoleOp

public final class love/forte/simbot/component/kook/util/KookBotRequests {
public static final synthetic fun request (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestAsync (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestBlocking (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Lio/ktor/client/statement/HttpResponse;
public static final synthetic fun requestBy (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestByAsync (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestByBlocking (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Lio/ktor/client/statement/HttpResponse;
public static final fun requestByReserve (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
public static final synthetic fun requestData (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestDataAsync (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestDataBlocking (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Ljava/lang/Object;
public static final synthetic fun requestDataBy (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestDataByAsync (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestDataByBlocking (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Ljava/lang/Object;
public static final fun requestDataByReserve (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
public static final fun requestDataReserve (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
public static final fun requestReserve (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
public static final synthetic fun requestResult (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestResultAsync (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestResultBlocking (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Llove/forte/simbot/kook/api/ApiResult;
public static final synthetic fun requestResultBy (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestResultByAsync (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestResultByBlocking (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Llove/forte/simbot/kook/api/ApiResult;
public static final fun requestResultByReserve (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
public static final fun requestResultReserve (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
public static final synthetic fun requestText (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestTextAsync (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestTextBlocking (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Ljava/lang/String;
public static final synthetic fun requestTextBy (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun requestTextByAsync (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Ljava/util/concurrent/CompletableFuture;
public static final fun requestTextByBlocking (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Ljava/lang/String;
public static final fun requestTextByReserve (Llove/forte/simbot/kook/api/KookApi;Llove/forte/simbot/component/kook/bot/KookBot;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
public static final fun requestTextReserve (Llove/forte/simbot/component/kook/bot/KookBot;Llove/forte/simbot/kook/api/KookApi;)Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
}

public final class love/forte/simbot/component/kook/util/RegexWalkerKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
@file:JvmName("KookBotRequests")
@file:JvmMultifileClass

package love.forte.simbot.component.kook.util

Expand All @@ -30,6 +31,7 @@ import love.forte.simbot.kook.stdlib.requestBy
import love.forte.simbot.kook.stdlib.requestDataBy
import love.forte.simbot.kook.stdlib.requestResultBy
import love.forte.simbot.kook.stdlib.requestTextBy
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.jvm.JvmSynthetic

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
/*
* Copyright (c) 2025. ForteScarlet.
*
* This file is part of simbot-component-kook.
*
* simbot-component-kook is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* simbot-component-kook is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with simbot-component-kook,
* If not, see <https://www.gnu.org/licenses/>.
*/

@file:JvmName("KookBotRequests")
@file:JvmMultifileClass

package love.forte.simbot.component.kook.util

import io.ktor.client.statement.*
import love.forte.simbot.annotations.Api4J
import love.forte.simbot.annotations.InternalSimbotAPI
import love.forte.simbot.component.kook.bot.KookBot
import love.forte.simbot.kook.api.ApiResult
import love.forte.simbot.kook.api.KookApi
import love.forte.simbot.suspendrunner.asReserve
import love.forte.simbot.suspendrunner.reserve.SuspendReserve
import love.forte.simbot.suspendrunner.runInAsync
import love.forte.simbot.suspendrunner.runInNoScopeBlocking
import java.util.concurrent.CompletableFuture

//region request
/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.request
* @since 4.1.1
*/
@Api4J
public fun KookBot.requestBlocking(api: KookApi<*>): HttpResponse =
runInNoScopeBlocking { request(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.request
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookBot.requestAsync(api: KookApi<*>): CompletableFuture<out HttpResponse> =
runInAsync(scope = this) { request(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.request
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookBot.requestReserve(api: KookApi<*>): SuspendReserve<HttpResponse> =
asReserve(scope = this) { request(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestData
* @since 4.1.1
*/
@Api4J
public fun <T : Any> KookBot.requestDataBlocking(api: KookApi<T>): T =
runInNoScopeBlocking { requestData(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestData
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun <T : Any> KookBot.requestDataAsync(api: KookApi<T>): CompletableFuture<out T> =
runInAsync(scope = this) { requestData(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestData
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun <T : Any> KookBot.requestDataReserve(api: KookApi<T>): SuspendReserve<T> =
asReserve(scope = this) { requestData(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestText
* @since 4.1.1
*/
@Api4J
public fun KookBot.requestTextBlocking(api: KookApi<*>): String =
runInNoScopeBlocking { requestText(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestText
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookBot.requestTextAsync(api: KookApi<*>): CompletableFuture<out String> =
runInAsync(scope = this) { requestText(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestText
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookBot.requestTextReserve(api: KookApi<*>): SuspendReserve<String> =
asReserve(scope = this) { requestText(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestResult
* @since 4.1.1
*/
@Api4J
public fun KookBot.requestResultBlocking(api: KookApi<*>): ApiResult =
runInNoScopeBlocking { requestResult(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestResult
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookBot.requestResultAsync(api: KookApi<*>): CompletableFuture<out ApiResult> =
runInAsync(scope = this) { requestResult(api) }

/**
* 使用 [KookBot] 对 [api] 发起请求。
* @see KookBot.requestResult
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookBot.requestResultReserve(api: KookApi<*>): SuspendReserve<ApiResult> =
asReserve(scope = this) { requestResult(api) }
//endregion

//region requestBy
/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestBy
* @since 4.1.1
*/
@Api4J
public fun KookApi<*>.requestByBlocking(bot: KookBot): HttpResponse =
runInNoScopeBlocking { requestBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookApi<*>.requestByAsync(bot: KookBot): CompletableFuture<out HttpResponse> =
runInAsync(scope = bot) { requestBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookApi<*>.requestByReserve(bot: KookBot): SuspendReserve<HttpResponse> =
asReserve(scope = bot) { requestBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestDataBy
* @since 4.1.1
*/
@Api4J
public fun <T : Any> KookApi<T>.requestDataByBlocking(bot: KookBot): T =
runInNoScopeBlocking { requestDataBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestDataBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun <T : Any> KookApi<T>.requestDataByAsync(bot: KookBot): CompletableFuture<out T> =
runInAsync(scope = bot) { requestDataBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestDataBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun <T : Any> KookApi<T>.requestDataByReserve(bot: KookBot): SuspendReserve<T> =
asReserve(scope = bot) { requestDataBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestTextBy
* @since 4.1.1
*/
@Api4J
public fun KookApi<*>.requestTextByBlocking(bot: KookBot): String =
runInNoScopeBlocking { requestTextBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestTextBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookApi<*>.requestTextByAsync(bot: KookBot): CompletableFuture<out String> =
runInAsync(scope = bot) { requestTextBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestTextBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookApi<*>.requestTextByReserve(bot: KookBot): SuspendReserve<String> =
asReserve(scope = bot) { requestTextBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestResultBy
* @since 4.1.1
*/
@Api4J
public fun KookApi<*>.requestResultByBlocking(bot: KookBot): ApiResult =
runInNoScopeBlocking { requestResultBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestResultBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookApi<*>.requestResultByAsync(bot: KookBot): CompletableFuture<out ApiResult> =
runInAsync(scope = bot) { requestResultBy(bot) }

/**
* 使用 [KookApi] 通过 [bot] 发起请求。
* @see KookApi.requestResultBy
* @since 4.1.1
*/
@Api4J
@OptIn(InternalSimbotAPI::class)
public fun KookApi<*>.requestResultByReserve(bot: KookBot): SuspendReserve<ApiResult> =
asReserve(scope = bot) { requestResultBy(bot) }
//endregion
Loading
Loading