diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/CreateGroupFileFolderApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/CreateGroupFileFolderApi.kt new file mode 100644 index 0000000..39d6eb0 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/CreateGroupFileFolderApi.kt @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`create_group_file_folder`-创建群文件文件夹](https://docs.go-cqhttp.org/api/#创建群文件文件夹) + * + * @author kuku + */ +public class CreateGroupFileFolderApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "create_group_file_folder" + + /** + * 构建一个 [CreateGroupFileFolderApi]. + * + * @param groupId 群号 + * @param name 文件夹名称 + */ + @JvmStatic + public fun create(groupId: ID, name: String): CreateGroupFileFolderApi = + CreateGroupFileFolderApi(Body(groupId, name)) + + } + + /** + * @property groupId 群号 + * @property name 文件夹名称 + * @property parentId 仅能为 / + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: ID, + @SerialName("name") + internal val name: String, + @SerialName("parent_id") + internal val parentId: String = "/" + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteEssenceMsgApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteEssenceMsgApi.kt new file mode 100644 index 0000000..ca29f99 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteEssenceMsgApi.kt @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`delete_essence_msg`-移出精华消息](https://docs.go-cqhttp.org/api/#移出精华消息) + * + * @author kuku + */ +public class DeleteEssenceMsgApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + public companion object Factory { + private const val ACTION: String = "delete_essence_msg" + + + /** + * 构建一个 [DeleteEssenceMsgApi]. + * + * @param messageId 消息ID + */ + @JvmStatic + public fun create(messageId: ID): DeleteEssenceMsgApi = + DeleteEssenceMsgApi(Body(messageId)) + + } + + /** + * @property messageId 消息ID + */ + @Serializable + internal data class Body( + @SerialName("message_id") + internal val messageId: ID + ) + +} + diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteGroupFileApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteGroupFileApi.kt new file mode 100644 index 0000000..ee79225 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteGroupFileApi.kt @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`delete_group_file`-删除群文件](https://docs.go-cqhttp.org/api/#删除群文件) + * + * @author kuku + */ +public class DeleteGroupFileApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "delete_group_file" + + /** + * 构建一个 [DeleteGroupFileApi]. + * + * @param groupId 群号 + * @param fileId 文件ID 参考 File 对象 + * @param busid 文件类型 参考 File 对象 + */ + @JvmStatic + public fun create(groupId: ID, fileId: String, busid: String): DeleteGroupFileApi = + DeleteGroupFileApi(Body(groupId, fileId, busid)) + + } + + /** + * @property groupId 群号 + * @property fileId 文件ID 参考 File 对象 + * @property busid 文件类型 参考 File 对象 + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: ID, + @SerialName("file_id") + internal val fileId: String, + @SerialName("busid") + internal val busid: String + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteGroupFolderApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteGroupFolderApi.kt new file mode 100644 index 0000000..355b0be --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DeleteGroupFolderApi.kt @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`delete_group_folder`-删除群文件文件夹](https://docs.go-cqhttp.org/api/#删除群文件文件夹) + * + * @author kuku + */ +public class DeleteGroupFolderApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "delete_group_folder" + + /** + * 构建一个 [CreateGroupFileFolderApi]. + * + * @param groupId 群号 + * @param folderId 文件夹ID 参考 Folder 对象 + */ + @JvmStatic + public fun create(groupId: ID, folderId: String): DeleteGroupFolderApi = + DeleteGroupFolderApi(Body(groupId, folderId)) + + } + + /** + * @property groupId 群号 + * @property folderId 文件夹ID 参考 Folder 对象 + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: ID, + @SerialName("folder_id") + internal val folderId: String, + ) + +} + diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DownloadFileApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DownloadFileApi.kt new file mode 100644 index 0000000..960e6f2 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/DownloadFileApi.kt @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmOverloads +import kotlin.jvm.JvmStatic + +/** + * [`download_file`-下载文件到缓存目录](https://docs.go-cqhttp.org/api/#下载文件到缓存目录) + * + * @author kuku + */ +public class DownloadFileApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = DownloadFileResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + + public companion object Factory { + private const val ACTION: String = "download_file" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(DownloadFileResult.serializer()) + + /** + * 构建一个 [DownloadFileApi]. + * + * @param url 链接地址 + * @param base64 base64编码的文件内容 + * @param threadCount 下载线程数 + * @param headers 自定义请求头 + */ + @JvmStatic + @JvmOverloads + public fun create(url: String? = null, base64: String? = null, threadCount: Int? = null, headers: String? = null): DownloadFileApi = + DownloadFileApi(Body(url, base64, threadCount, headers)) + } + + /** + * @property url 链接地址 + * @property threadCount 下载线程数 + * @property base64 base64编码的文件内容 + * @property headers 自定义请求头 + */ + @Serializable + internal data class Body( + @SerialName("url") + internal val url: String? = null, + @SerialName("base64") + internal val base64: String? = null, + @SerialName("thread_count") + internal val threadCount: Int? = null, + @SerialName("headers") + internal val headers: String? = null + ) + +} + + +/** + * [DownloadFileApi] 的响应体。 + * + * @property file 下载文件的绝对路径 + */ +@Serializable +public data class DownloadFileResult @ApiResultConstructor constructor( + public val file: String +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupAtAllRemainApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupAtAllRemainApi.kt new file mode 100644 index 0000000..fd6421c --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupAtAllRemainApi.kt @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`get_group_at_all_remain`-获取群 @全体成员 剩余次数](https://docs.go-cqhttp.org/api/#获取群-全体成员-剩余次数) + * + * @author kuku + */ +public class GetGroupAtAllRemainApi private constructor( + override val body: Any, +): OneBotApi{ + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = GetGroupAtAllRemainResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + public companion object Factory { + private const val ACTION: String = "get_group_at_all_remain" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(GetGroupAtAllRemainResult.serializer()) + + /** + * 构建一个 [GetGroupAtAllRemainApi]. + * + * @param groupId 群号 + */ + @JvmStatic + public fun create(groupId: ID): GetGroupAtAllRemainApi = + GetGroupAtAllRemainApi(Body(groupId)) + } + + /** + * @property groupId 群号 + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: ID + ) + +} + +/** + * [GetGroupAtAllRemainApi] 的响应体。 + * + * @property canAtAll 是否可以 @全体成员 + * @property remainAtAllCountForGroup 群内所有管理当天剩余 @全体成员 次数 + * @property remainAtAllCountForUin Bot 当天剩余 @全体成员 次数 + */ +@Serializable +public data class GetGroupAtAllRemainResult @ApiResultConstructor constructor( + @SerialName("can_at_all") + val canAtAll: Boolean, + @SerialName("remain_at_all_count_for_group") + val remainAtAllCountForGroup: Int, + @SerialName("remain_at_all_count_for_uin") + val remainAtAllCountForUin: Int +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupMsgHistoryApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupMsgHistoryApi.kt new file mode 100644 index 0000000..ce2f3de --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupMsgHistoryApi.kt @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.GetMsgResult +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`get_group_msg_history`-获取群消息历史记录](https://docs.go-cqhttp.org/api/#获取群消息历史记录) + * + * @author kuku + */ +public class GetGroupMsgHistoryApi( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = GetGroupMsgHistoryResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + + public companion object Factory { + private const val ACTION: String = "get_group_msg_history" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(GetGroupMsgHistoryResult.serializer()) + + /** + * 构建一个 [GetGroupMsgHistoryApi]. + * + * @param groupId 群号 + * @param messageSeq 起始消息序号, 可通过 get_msg 获得 + */ + @JvmStatic + public fun create(groupId: LongID, messageSeq: LongID? = null): GetGroupMsgHistoryApi = + GetGroupMsgHistoryApi(Body(messageSeq, groupId)) + } + + /** + * @property messageSeq 起始消息序号, 可通过 get_msg 获得 + * @property groupId 群号 + */ + @Serializable + internal data class Body( + @SerialName("message_seq") + internal val messageSeq: LongID? = null, + @SerialName("group_id") + internal val groupId: LongID + ) + +} + + +/** + * [GetGroupMsgHistoryApi] 的响应体。 + * + * @property messages 从起始序号开始的前19条消息 + */ +@Serializable +public data class GetGroupMsgHistoryResult @ApiResultConstructor constructor( + val messages: List +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupRootFilesApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupRootFilesApi.kt new file mode 100644 index 0000000..4e62952 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupRootFilesApi.kt @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`get_group_root_files`-获取群根目录文件列表](https://docs.go-cqhttp.org/api/#获取群根目录文件列表) + * + * @author kuku + */ +public class GetGroupRootFilesApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = GetGroupRootFilesResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + public companion object Factory { + private const val ACTION: String = "get_group_root_files" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(GetGroupRootFilesResult.serializer()) + + /** + * 构建一个 [GetGroupRootFilesApi]. + * + * @param groupId 群号 + */ + @JvmStatic + public fun create(groupId: ID): GetGroupRootFilesApi = + GetGroupRootFilesApi(Body(groupId)) + } + + /** + * @property groupId 群号 + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: ID + ) + +} + +/** + * [GetGroupRootFilesApi] 的响应体。 + * + * @property files 文件列表 + * @property folders 文件夹列表 + */ +@Serializable +public data class GetGroupRootFilesResult @ApiResultConstructor constructor( + val files: List = emptyList(), + val folders: List = emptyList() +) + +/** + * go-cqhttp 文件信息 + * + * @property groupId 群号 + * @property fileId 文件ID + * @property fileName 文件名 + * @property busid 文件类型 + * @property fileSize 文件大小 + * @property uploadTime 上传时间 + * @property deadTime 过期时间,永久文件恒为0 + * @property modifyTime 最后修改时间 + * @property downloadTimes 下载次数 + * @property uploader 上传者ID + * @property uploaderName 上传者名字 + */ +@Serializable +public data class GoCqHttpFile( + @SerialName("group_id") + val groupId: LongID, + @SerialName("file_id") + val fileId: String, + @SerialName("file_name") + val fileName: String, + @SerialName("busid") + val busid: Int, + @SerialName("file_size") + val fileSize: Long, + @SerialName("upload_time") + val uploadTime: Long, + @SerialName("dead_time") + val deadTime: Long, + @SerialName("modify_time") + val modifyTime: Long, + @SerialName("download_times") + val downloadTimes: Int, + @SerialName("uploader") + val uploader: LongID, + @SerialName("uploader_name") + val uploaderName: String +) + +/** + * go-cqhttp 文件夹信息 + * + * @property groupId 群号 + * @property folderId 文件夹ID + * @property folderName 文件名 + * @property createTime 创建时间 + * @property creator 创建者 + * @property creatorName 创建者名字 + * @property totalFileCount 子文件数量 + */ +@Serializable +public data class GoCqHttpFolder( + @SerialName("group_id") + val groupId: LongID, + @SerialName("folder_id") + val folderId: String, + @SerialName("folder_name") + val folderName: String, + @SerialName("create_time") + val createTime: Long, + @SerialName("creator") + val creator: LongID, + @SerialName("creator_name") + val creatorName: String, + @SerialName("total_file_count") + val totalFileCount: Int +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupSystemMsgApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupSystemMsgApi.kt new file mode 100644 index 0000000..5b369d2 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/GetGroupSystemMsgApi.kt @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`get_group_system_msg`-获取群系统消息](https://docs.go-cqhttp.org/api/#获取群系统消息) + * + * @author kuku + */ +public class GetGroupSystemMsgApi private constructor( + override val body: Any?, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = GetGroupSystemMsgResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + public companion object Factory { + private const val ACTION: String = "get_group_system_msg" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(GetGroupSystemMsgResult.serializer()) + + /** + * 构建一个 [GetGroupSystemMsgApi]. + * + */ + @JvmStatic + public fun create(): GetGroupSystemMsgApi = GetGroupSystemMsgApi(null) + } + +} + +/** + * [GetGroupSystemMsgApi] 的响应体。 + * + * @property invitedRequests 邀请消息列表 + * @property joinRequests 进群消息列表 + */ +@Serializable +public data class GetGroupSystemMsgResult @ApiResultConstructor constructor( + @SerialName("invited_requests") + public val invitedRequests: List = emptyList(), + @SerialName("join_requests") + public val joinRequests: List = emptyList(), +) { + + /** + * 邀请消息 + * @property requestId 请求ID + * @property invitorUin 邀请者 + * @property invitorNick 邀请者昵称 + * @property groupId 群号 + * @property groupName 群名 + * @property checked 是否已被处理 + * @property actor 处理者, 未处理为0 + */ + @Serializable + public data class InvitedRequest( + @SerialName("request_id") + val requestId: Long, + @SerialName("invitor_uin") + val invitorUin: LongID, + @SerialName("invitor_nick") + val invitorNick: String, + @SerialName("group_id") + val groupId: LongID, + @SerialName("group_name") + val groupName: String, + @SerialName("checked") + val checked: Boolean, + @SerialName("actor") + val actor: LongID + ) + + /** + * 邀请消息 + * @property requestId 请求ID + * @property requesterUin 请求者ID + * @property requesterNick 请求者昵称 + * @property message 验证消息 + * @property groupId 群号 + * @property groupName 群名 + * @property checked 是否已被处理 + * @property actor 处理者, 未处理为0 + */ + @Serializable + public data class JoinRequest( + @SerialName("request_id") + val requestId: Long, + @SerialName("requester_uin") + val requesterUin: LongID, + @SerialName("requester_nick") + val requesterNick: String, + @SerialName("message") + val message: String, + @SerialName("group_id") + val groupId: LongID, + @SerialName("group_name") + val groupName: String, + @SerialName("checked") + val checked: Boolean, + @SerialName("actor") + val actor: LongID + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/MarkMsgAsReadApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/MarkMsgAsReadApi.kt new file mode 100644 index 0000000..4e25c99 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/MarkMsgAsReadApi.kt @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`mark_msg_as_read`-标记消息已读](https://docs.go-cqhttp.org/api/#标记消息已读) + * + * @author kuku + */ +public class MarkMsgAsReadApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + public companion object Factory { + private const val ACTION: String = "mark_msg_as_read" + + + /** + * 构建一个 [MarkMsgAsReadApi]. + * + * @param messageId 消息ID + */ + @JvmStatic + public fun create(messageId: ID): MarkMsgAsReadApi = + MarkMsgAsReadApi(Body(messageId)) + + } + + /** + * @property messageId 消息ID + */ + @Serializable + internal data class Body( + @SerialName("message_id") + internal val messageId: ID + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendGroupForwardMsg.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendGroupForwardMsg.kt new file mode 100644 index 0000000..d8f87d8 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendGroupForwardMsg.kt @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import love.forte.simbot.component.onebot.v11.core.api.OneBotMessageOutgoing +import love.forte.simbot.component.onebot.v11.message.segment.OneBotForwardNode +import kotlin.jvm.JvmStatic + +/** + * [`send_group_forward_msg`-发送合并转发 ( 群聊 )](https://docs.go-cqhttp.org/api/#发送合并转发-群聊) + * + * @author kuku + */ +public class SendGroupForwardMsgApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = SendForwardMsgResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + + public companion object Factory { + private const val ACTION: String = "send_group_forward_msg" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(SendForwardMsgResult.serializer()) + + /** + * 构建一个 [SendPrivateForwardMsgApi]. + * + * @param groupId 群号 + * @param messages 自定义转发消息 + */ + @JvmStatic + public fun create(groupId: LongID, messages: List): SendGroupForwardMsgApi = + SendGroupForwardMsgApi(Body(groupId, OneBotMessageOutgoing.create(messages))) + } + + /** + * @property groupId 群号 + * @property messages 自定义转发消息 + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: LongID, + @SerialName("messages") + internal val messages: OneBotMessageOutgoing + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendGroupNoticeApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendGroupNoticeApi.kt new file mode 100644 index 0000000..a166b94 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendGroupNoticeApi.kt @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`_send_group_notice`-发送群公告](https://docs.go-cqhttp.org/api/#发送群公告) + * + * @author kuku + */ +public class SendGroupNoticeApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "_send_group_notice" + + /** + * 构建一个 [DeleteGroupFileApi]. + * + * @param groupId 群号 + * @param content 公告内容 + * @param image 图片路径(可选) + */ + @JvmStatic + public fun create(groupId: ID, content: String, image: String? = null): SendGroupNoticeApi = + SendGroupNoticeApi(Body(groupId, content, image)) + + } + + /** + * @property groupId 群号 + * @property content 公告内容 + * @property image 图片路径(可选) + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: ID, + @SerialName("content") + internal val content: String, + @SerialName("image") + internal val image: String? = null + ) + +} + diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendPrivateForwardMsgApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendPrivateForwardMsgApi.kt new file mode 100644 index 0000000..621fe29 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SendPrivateForwardMsgApi.kt @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import love.forte.simbot.component.onebot.v11.core.api.OneBotMessageOutgoing +import love.forte.simbot.component.onebot.v11.message.segment.OneBotForwardNode +import kotlin.jvm.JvmStatic + +/** + * [`send_private_forward_msg`-发送合并转发 ( 好友 )](https://docs.go-cqhttp.org/api/#发送合并转发-好友) + * + * @author kuku + */ +public class SendPrivateForwardMsgApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = SendForwardMsgResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + + public companion object Factory { + private const val ACTION: String = "send_private_forward_msg" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(SendForwardMsgResult.serializer()) + + /** + * 构建一个 [SendPrivateForwardMsgApi]. + * + * @param userId qq号 + * @param messages 自定义转发消息 + */ + @JvmStatic + public fun create(userId: LongID, messages: List): SendPrivateForwardMsgApi = + SendPrivateForwardMsgApi(Body(userId, OneBotMessageOutgoing.create(messages))) + } + + /** + * @property userId 链接地址 + * @property messages 自定义转发消息 + */ + @Serializable + internal data class Body( + @SerialName("user_id") + internal val userId: LongID, + @SerialName("messages") + internal val messages: OneBotMessageOutgoing + ) + +} + +/** + * [SendPrivateForwardMsgApi] 的响应体。 + * + * @property messageId 消息 ID + */ +@Serializable +public data class SendForwardMsgResult @ApiResultConstructor constructor( + @SerialName("message_id") + val messageId: LongID +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SetEssenceMsgApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SetEssenceMsgApi.kt new file mode 100644 index 0000000..1859a18 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/SetEssenceMsgApi.kt @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`set_essence_msg`-设置精华消息](https://docs.go-cqhttp.org/api/#设置精华消息) + * + * @author kuku + */ +public class SetEssenceMsgApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + public companion object Factory { + private const val ACTION: String = "set_essence_msg" + + + /** + * 构建一个 [SetEssenceMsgApi]. + * + * @param messageId 消息ID + */ + @JvmStatic + public fun create(messageId: ID): SetEssenceMsgApi = + SetEssenceMsgApi(Body(messageId)) + + } + + /** + * @property messageId 消息ID + */ + @Serializable + internal data class Body( + @SerialName("message_id") + internal val messageId: ID + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/UploadGroupFileApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/UploadGroupFileApi.kt new file mode 100644 index 0000000..cf9f7db --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/UploadGroupFileApi.kt @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmOverloads +import kotlin.jvm.JvmStatic + +/** + * [`upload_group_file`-上传群文件](https://docs.go-cqhttp.org/api/#上传群文件) + * + * @author kuku + */ +public class UploadGroupFileApi private constructor( + override val body: Any, +) : OneBotApi { + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "upload_group_file" + + /** + * 构建一个 [UploadGroupFileApi]. + * + * @param groupId 群号 + * @param file 本地文件路径 + * @param name 储存名称 + * @param folder 父目录ID + */ + @JvmStatic + @JvmOverloads + public fun create(groupId: ID, file: String, name: String, folder: String? = null): UploadGroupFileApi = + UploadGroupFileApi(Body(groupId, file, name, folder)) + + } + + /** + * @property groupId 群号 + * @property file 本地文件路径 + * @property name 储存名称 + * @property folder 父目录ID + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: ID, + @SerialName("file") + internal val file: String, + @SerialName("name") + internal val name: String, + @SerialName("folder") + internal val folder: String? = null + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/UploadPrivateFileApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/UploadPrivateFileApi.kt new file mode 100644 index 0000000..dc99e58 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/gocqhttp/core/api/UploadPrivateFileApi.kt @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.gocqhttp.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`upload_private_file`-上传私聊文件](https://docs.go-cqhttp.org/api/#上传私聊文件) + * + * @author kuku + */ +public class UploadPrivateFileApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + public companion object Factory { + private const val ACTION: String = "upload_private_file" + + + /** + * 构建一个 [UploadPrivateFileApi]. + * + * @param userId 对方 QQ 号 + * @param file 本地文件路径 + * @param name 储存名称 + */ + @JvmStatic + public fun create(userId: ID, file: String, name: String): UploadPrivateFileApi = + UploadPrivateFileApi(Body(userId, file, name)) + + } + + /** + * @property userId 对方 QQ 号 + * @property file 本地文件路径 + * @property name 储存名称 + */ + @Serializable + internal data class Body( + @SerialName("user_id") + internal val userId: ID, + @SerialName("file") + internal val file: String, + @SerialName("name") + internal val name: String, + ) + + + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/ForwardFriendSingleMsgApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/ForwardFriendSingleMsgApi.kt new file mode 100644 index 0000000..04b5d91 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/ForwardFriendSingleMsgApi.kt @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`forward_friend_single_msg`-转发单条消息到好友](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class ForwardFriendSingleMsgApi private constructor( + override val body: Any, +): OneBotApi { + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "forward_friend_single_msg" + + /** + * 构建一个 [ForwardFriendSingleMsgApi]. + * + * @param userId qq号 + * @param messageId 消息id + */ + @JvmStatic + public fun create(userId: LongID, messageId: ID): ForwardFriendSingleMsgApi = + ForwardFriendSingleMsgApi(Body(userId, messageId)) + + } + + /** + * @property userId qq号 + * @property messageId 消息id + */ + @Serializable + internal data class Body( + @SerialName("user_id") + internal val userId: LongID, + @SerialName("message_id") + internal val messageId: ID + ) +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/ForwardGroupSingleMsgApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/ForwardGroupSingleMsgApi.kt new file mode 100644 index 0000000..9a4f30d --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/ForwardGroupSingleMsgApi.kt @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`forward_group_single_msg`-转发单条消息到群](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class ForwardGroupSingleMsgApi private constructor( + override val body: Any, +): OneBotApi { + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "forward_group_single_msg" + + /** + * 构建一个 [ForwardGroupSingleMsgApi]. + * + * @param groupId 群号 + * @param messageId 消息id + */ + @JvmStatic + public fun create(groupId: LongID, messageId: ID): ForwardGroupSingleMsgApi = + ForwardGroupSingleMsgApi(Body(groupId, messageId)) + + } + + /** + * @property groupId 群号 + * @property messageId 消息id + */ + @Serializable + internal data class Body( + @SerialName("group_id") + internal val groupId: LongID, + @SerialName("message_id") + internal val messageId: ID + ) +} + diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetFileApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetFileApi.kt new file mode 100644 index 0000000..d3ec5b8 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetFileApi.kt @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import love.forte.simbot.component.gocqhttp.core.api.DownloadFileApi +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`get_file`-下载收到的群文件或私聊文件](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class GetFileApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = GetFileResult.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = RES_SER + + + public companion object Factory { + private const val ACTION: String = "get_file" + + private val RES_SER: KSerializer> = + OneBotApiResult.serializer(GetFileResult.serializer()) + + /** + * 构建一个 [DownloadFileApi]. + * + * @param fileId 文件id + */ + @JvmStatic + public fun create(fileId: String): GetFileApi = + GetFileApi(Body(fileId)) + } + + /** + * @property fileId 文件id + */ + @Serializable + internal data class Body( + @SerialName("file_id") + internal val fileId: String + ) + +} + +/** + * [GetFileApi] 的响应体。 + * + * @property file 文件的绝对路径 + * @property fileName 文件名 + * @property fileSize 文件大小 + * @property base64 文件的 base64 编码, 需要在 LLOneBot 的配置文件中开启 base64 + */ +@Serializable +public data class GetFileResult @ApiResultConstructor constructor( + val file: String, + @SerialName("file_name") + val fileName: String, + @SerialName("file_size") + val fileSize: Int, + val base64: String +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetFriendsWithCategoryApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetFriendsWithCategoryApi.kt new file mode 100644 index 0000000..ac5739f --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetFriendsWithCategoryApi.kt @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.ListSerializer +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`get_friends_with_category`-获取带分组信息好友列表](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class GetFriendsWithCategoryApi private constructor(): OneBotApi> { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy> + get() = SER + + override val apiResultDeserializer: DeserializationStrategy>> + get() = RES_SER + + override val body: Any? + get() = null + + public companion object Factory { + private const val ACTION: String = "get_friends_with_category" + + private val SER = ListSerializer(GetFriendsWithCategoryResult.serializer()) + + private val RES_SER = OneBotApiResult.serializer(SER) + + private val INSTANCE: GetFriendsWithCategoryApi = GetFriendsWithCategoryApi() + + /** + * 构建一个 [GetFriendsWithCategoryApi]. + */ + @JvmStatic + public fun create(): GetFriendsWithCategoryApi = INSTANCE + } + +} + +/** + * [GetFriendsWithCategoryApi] 的响应体。 + * + */ +@Serializable +public data class GetFriendsWithCategoryResult @ApiResultConstructor constructor( + val qid: String, + val longNick: String, + @SerialName("birthday_year") + val birthdayYear: Int, + @SerialName("birthday_month") + val birthdayMonth: Int, + @SerialName("birthday_day") + val birthdayDay: Int, + val age: Int, + val sex: String, + val eMail: String, + val phoneNum: String, + val categoryId: Int, + val richTime: Long, + val uid: String, + val uin: String, + val nick: String, + val remark: String, + @SerialName("user_id") + val userId: LongID, + val nickname: String, + val level: Int, + @SerialName("categroyName") + val categoryName: String +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetGroupIgnoreAddRequestApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetGroupIgnoreAddRequestApi.kt new file mode 100644 index 0000000..ff99e7c --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/GetGroupIgnoreAddRequestApi.kt @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.ListSerializer +import love.forte.simbot.common.id.LongID +import love.forte.simbot.component.onebot.common.annotations.ApiResultConstructor +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`get_group_ignore_add_request`-获取已过滤的加群通知](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class GetGroupIgnoreAddRequestApi private constructor(): OneBotApi> { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy> + get() = SER + + override val apiResultDeserializer: DeserializationStrategy>> + get() = RES_SER + + override val body: Any? + get() = null + + public companion object Factory { + private const val ACTION: String = "get_group_ignore_add_request" + + private val SER = ListSerializer(GetGroupIgnoreAddRequestResult.serializer()) + + private val RES_SER = OneBotApiResult.serializer(SER) + + private val INSTANCE: GetGroupIgnoreAddRequestApi = GetGroupIgnoreAddRequestApi() + + /** + * 构建一个 [GetGroupIgnoreAddRequestApi]. + */ + @JvmStatic + public fun create(): GetGroupIgnoreAddRequestApi = INSTANCE + } + +} + +/** + * [GetGroupIgnoreAddRequestApi] 的响应体。 + * + * @property groupId 群号 + * @property userId qq号 + * @property flag + */ +@Serializable +public data class GetGroupIgnoreAddRequestResult @ApiResultConstructor constructor( + @SerialName("group_id") + val groupId: LongID, + @SerialName("user_id") + val userId: LongID, + val flag: String +) diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetMsgEmojiLikeApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetMsgEmojiLikeApi.kt new file mode 100644 index 0000000..88a1fb2 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetMsgEmojiLikeApi.kt @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.common.id.ID +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`set_msg_emoji_like`-发送表情回应](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class SetMsgEmojiLikeApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "set_msg_emoji_like" + + /** + * 构建一个 [SetMsgEmojiLikeApi]. + * + * @param messageId 消息id + * @param emojiId 表情id,参考 https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#EmojiType + */ + @JvmStatic + public fun create(messageId: ID, emojiId: ID): SetMsgEmojiLikeApi = + SetMsgEmojiLikeApi(Body(messageId, emojiId)) + + } + + /** + * @property messageId 消息id + * @property emojiId 表情id,参考 https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#EmojiType + */ + @Serializable + internal data class Body( + @SerialName("message_id") + internal val messageId: ID, + @SerialName("emoji_id") + internal val emojiId: ID, + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetOnlineStatusApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetOnlineStatusApi.kt new file mode 100644 index 0000000..11f00c7 --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetOnlineStatusApi.kt @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`set_online_status`-设置自身在线状态](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class SetOnlineStatusApi private constructor( + override val body: Any, +): OneBotApi { + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "set_online_status" + + /** + * 构建一个 [SetOnlineStatusApi]. + * + * @param status + * @param extStatus + * @param batteryStatus + */ + @JvmStatic + public fun create(status: Int, extStatus: Int, batteryStatus: Int): SetOnlineStatusApi = + SetOnlineStatusApi(Body(status, extStatus, batteryStatus)) + + } + + /** + * @property status + * @property status + * @property batteryStatus + */ + @Serializable + internal data class Body( + @SerialName("status") + internal val status: Int, + @SerialName("ext_status") + internal val extStatus: Int, + @SerialName("battery_status") + internal val batteryStatus: Int, + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetQqAvatarApi.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetQqAvatarApi.kt new file mode 100644 index 0000000..b96cc0f --- /dev/null +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/llonebot/core/api/SetQqAvatarApi.kt @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024. ForteScarlet. + * + * This file is part of simbot-component-onebot. + * + * simbot-component-onebot 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-onebot 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-onebot. + * If not, see . + */ + +package love.forte.simbot.component.llonebot.core.api + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.serializer +import love.forte.simbot.component.onebot.v11.core.api.OneBotApi +import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult +import kotlin.jvm.JvmStatic + +/** + * [`set_qq_avatar`-设置头像](https://llonebot.github.io/zh-CN/develop/extends_api) + * + * @author kuku + */ +public class SetQqAvatarApi private constructor( + override val body: Any, +): OneBotApi{ + + override val action: String + get() = ACTION + + override val resultDeserializer: DeserializationStrategy + get() = Unit.serializer() + + override val apiResultDeserializer: DeserializationStrategy> + get() = OneBotApiResult.emptySerializer() + + + public companion object Factory { + private const val ACTION: String = "set_qq_avatar" + + /** + * 构建一个 [SetQqAvatarApi]. + * + * @param file 文件路径 支持http://, base64://, file:// + */ + @JvmStatic + public fun create(file: String): SetQqAvatarApi = + SetQqAvatarApi(Body(file)) + + } + + /** + * @property file 文件路径 支持http://, base64://, file:// + */ + @Serializable + internal data class Body( + @SerialName("file") + internal val file: String + ) + +} diff --git a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/segment/OneBotForward.kt b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/segment/OneBotForward.kt index bb34d7f..c8ff2c2 100644 --- a/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/segment/OneBotForward.kt +++ b/simbot-component-onebot-v11/simbot-component-onebot-v11-message/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/message/segment/OneBotForward.kt @@ -106,6 +106,8 @@ public class OneBotForwardNode private constructor( id = null, userId = userId, nickname = nickname, + name = nickname, + uin = userId, content = content, ) ) @@ -115,6 +117,11 @@ public class OneBotForwardNode private constructor( * 一个普通的节点或一个自定义节点. * 如果没有 [id],则应当存在 [userId]、[nickname]、[content]。 * + * @property userId onebot标准 发送者QQ号 + * @property nickname onebot标准 发送者名字 + * @property name cqhttp标准 发送者显示名字 + * @property uin cqhttp标准 发送者QQ号 + * * @author ForteScarlet */ @Serializable @@ -123,6 +130,8 @@ public class OneBotForwardNode private constructor( @SerialName("user_id") val userId: ID? = null, val nickname: String? = null, + val name: String? = null, + val uin: ID? = null, val content: List? = null, ) }