From f811b37ecdfde84e0b93cb6d9a7b2277024e416f Mon Sep 17 00:00:00 2001 From: RTAkland Date: Fri, 6 Dec 2024 12:59:01 +0800 Subject: [PATCH] fix @JvmOverloads error and cleanup code --- .../cn/rtast/rob/enums/AIRecordCharacter.kt | 2 -- .../kotlin/cn/rtast/rob/enums/BusinessName.kt | 2 -- .../cn/rtast/rob/onebot/OneBotAction.kt | 26 ------------------- 3 files changed, 30 deletions(-) diff --git a/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/AIRecordCharacter.kt b/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/AIRecordCharacter.kt index 8dfb1c3..946fad4 100644 --- a/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/AIRecordCharacter.kt +++ b/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/AIRecordCharacter.kt @@ -8,8 +8,6 @@ package cn.rtast.rob.enums -import cn.rtast.rob.enums.AIRecordCharacter.entries - /** * 定义几个常用的AI音色枚举类 diff --git a/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/BusinessName.kt b/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/BusinessName.kt index 2ec298d..20f86a0 100644 --- a/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/BusinessName.kt +++ b/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/enums/BusinessName.kt @@ -7,8 +7,6 @@ package cn.rtast.rob.enums -import cn.rtast.rob.enums.BusinessName.entries - enum class BusinessName(val type: Int, val description: String) { BigVIP(113, "QQ大会员"), VIP(1, "QQ会员"), YellowDiamond(102, "黄钻"), diff --git a/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/onebot/OneBotAction.kt b/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/onebot/OneBotAction.kt index 54ac866..98c9d78 100644 --- a/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/onebot/OneBotAction.kt +++ b/ronebot-onebot-v11/src/main/kotlin/cn/rtast/rob/onebot/OneBotAction.kt @@ -438,7 +438,6 @@ class OneBotAction internal constructor( /** * 设置成群员的群昵称 */ - @JvmOverloads suspend fun setGroupMemberCard(groupId: Long, userId: Long, card: String = "") { this.send(SetGroupMemberCardOut(params = SetGroupMemberCardOut.Params(groupId, userId, card))) } @@ -453,7 +452,6 @@ class OneBotAction internal constructor( /** * 退出群聊,如果是群主并且dismiss为true则解散群聊 */ - @JvmOverloads suspend fun setGroupLeaveOrDismiss(groupId: Long, dismiss: Boolean = false) { this.send(SetGroupLeaveOut(params = SetGroupLeaveOut.Params(groupId, dismiss))) } @@ -461,7 +459,6 @@ class OneBotAction internal constructor( /** * 处理加好友请求 */ - @JvmOverloads suspend fun setFriendRequest(flag: String, approve: Boolean = true, remark: String = "") { this.send(SetFriendRequestOut(params = SetFriendRequestOut.Params(flag, approve, remark))) } @@ -469,7 +466,6 @@ class OneBotAction internal constructor( /** * 处理加群请求 */ - @JvmOverloads suspend fun setGroupRequest( flag: String, type: String, @@ -504,7 +500,6 @@ class OneBotAction internal constructor( /** * 获取陌生人信息 */ - @JvmOverloads suspend fun getStrangerInfo(userId: Long, noCache: Boolean = false): StrangerInfo.StrangerInfo { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -527,7 +522,6 @@ class OneBotAction internal constructor( /** * 获取群组信息 */ - @JvmOverloads suspend fun getGroupInfo(groupId: Long, noCache: Boolean = false): GroupInfo.GroupInfo { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -550,7 +544,6 @@ class OneBotAction internal constructor( /** * 获取群组成员信息 */ - @JvmOverloads suspend fun getGroupMemberInfo(groupId: Long, userId: Long, noCache: Boolean = false): GroupMemberList.MemberInfo { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -700,7 +693,6 @@ class OneBotAction internal constructor( * `folder` -> 群内的目录 * ***注意: 文件路径是OneBot实现的本地路径*** */ - @JvmOverloads suspend fun uploadGroupFile(groupId: Long, file: String, name: String, folder: String = "/") { this.send(UploadGroupFileOut(params = UploadGroupFileOut.Params(groupId, file, name, folder))) } @@ -756,7 +748,6 @@ class OneBotAction internal constructor( * 该方法是Lagrange.OneBot的拓展API * 用于设置群组成员专属头衔 */ - @JvmOverloads suspend fun setGroupMemberSpecialTitle(groupId: Long, userId: Long, title: String = "", duration: Int = -1) { this.send(SetGroupMemberTitleOut(params = SetGroupMemberTitleOut.Params(groupId, userId, title, duration))) } @@ -766,7 +757,6 @@ class OneBotAction internal constructor( * 该方法被Lagrange标记为`隐藏API` * 并且为异步发送API不会有返回值 */ - @JvmOverloads suspend fun releaseGroupNoticeAsync(groupId: Long, content: String, image: String = "") { this.send( ReleaseGroupNoticeOut( @@ -783,7 +773,6 @@ class OneBotAction internal constructor( * 如果传入会导致发送失败, 截至: 24/10/01: 15:11 * 返回一个String类型的公告ID */ - @JvmOverloads suspend fun releaseGroupNotice(groupId: Long, content: String, image: String = ""): String { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -827,7 +816,6 @@ class OneBotAction internal constructor( * 需要提供message_id, isAdd参数如果为false则表示 * 取消对这条消息的reaction */ - @JvmOverloads suspend fun reaction(groupId: Long, messageId: Long, code: String, isAdd: Boolean = true) { this.send(ReactionOut(params = ReactionOut.Params(groupId, messageId, code, isAdd))) } @@ -838,7 +826,6 @@ class OneBotAction internal constructor( * 需要提供message_id, isAdd参数如果为false则表示 * 取消对这条消息的reaction */ - @JvmOverloads suspend fun reaction(groupId: Long, messageId: Long, code: QQFace, isAdd: Boolean = true) { this.send(ReactionOut(params = ReactionOut.Params(groupId, messageId, code.id.toString(), isAdd))) } @@ -908,7 +895,6 @@ class OneBotAction internal constructor( * 用于获取群聊中某个消息ID之前的历史聊天记录 * 默认只获取20条聊天记录 */ - @JvmOverloads suspend fun getGroupMessageHistory( groupId: Long, messageId: Long, @@ -938,7 +924,6 @@ class OneBotAction internal constructor( * 用于获取私聊中某个消息ID之前的历史聊天记录 * 默认只获取20条聊天记录 */ - @JvmOverloads suspend fun getPrivateMessageHistory( userId: Long, messageId: Long, @@ -1033,7 +1018,6 @@ class OneBotAction internal constructor( * 如果传入base64不能附带base64图片前缀 * 例如`data:image/png;base64` */ - @JvmOverloads suspend fun uploadImage(image: String, base64: Boolean = false): String { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -1048,7 +1032,6 @@ class OneBotAction internal constructor( * 用于设置机器人的头像, 如果传入的是base64则 * 不能有base64前缀 */ - @JvmOverloads suspend fun setBotAvatar(image: String, base64: Boolean = false): Boolean { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -1087,7 +1070,6 @@ class OneBotAction internal constructor( * 该方法是Go-CQHTTP的API * 用于OCR一个图片获取文字所在的坐标位置 */ - @JvmOverloads suspend fun ocrImage(image: String, base64: Boolean = false): OCRImage.ORCResult? { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -1144,7 +1126,6 @@ class OneBotAction internal constructor( * 该方法是Go-CQHTTP的API * 用于删除好友操作 */ - @JvmOverloads suspend fun deleteFriend(userId: Long, block: Boolean = true) { this.send(DeleteFriendOut(DeleteFriendOut.Params(userId, block))) } @@ -1167,7 +1148,6 @@ class OneBotAction internal constructor( * 该方法是Go-CQHTTP的API * 用于创建群文件中的文件夹 */ - @JvmOverloads suspend fun createGroupFileFolder(groupId: Long, name: String, parentId: String = "/") { this.send(CreateGroupFileFolderOut(CreateGroupFileFolderOut.Params(groupId, name, parentId))) } @@ -1197,7 +1177,6 @@ class OneBotAction internal constructor( * 用于获取AI声聊的语音类型 * [chatType]只能传1u */ - @JvmOverloads suspend fun getAIRecordCharacters(groupId: Long, chatType: UInt = 1u): AIRecordCharacters { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -1213,7 +1192,6 @@ class OneBotAction internal constructor( * [chatType]只能传1u * 如果生成失败则返回null */ - @JvmOverloads suspend fun getAIRecord(groupId: Long, character: String, text: String, chatType: UInt = 1u): String? { val uuid = UUID.randomUUID() val deferred = this.createCompletableDeferred(uuid) @@ -1233,7 +1211,6 @@ class OneBotAction internal constructor( * 用于生成指定音色的AI声音 * 但是使用了已知的[character] ([AIRecordCharacter])枚举类来发送 */ - @JvmOverloads suspend fun getAIRecord(groupId: Long, character: AIRecordCharacter, text: String, chatType: UInt = 1u): String? { return this.getAIRecord(groupId, character.characterId, text, chatType) } @@ -1244,7 +1221,6 @@ class OneBotAction internal constructor( * [character]是[getAIRecordCharacters]返回的[AIRecordCharacters.Character.characterId] * [chatType]只能传1u */ - @JvmOverloads suspend fun sendGroupAIRecord(groupId: Long, character: String, text: String, chatType: UInt = 1u) { this.send( GetAIRecordAndSendRecordOut( @@ -1260,7 +1236,6 @@ class OneBotAction internal constructor( * 用于生成指定音色的AI声音 * 但是使用了已知的[character] ([AIRecordCharacter])枚举类来发送 */ - @JvmOverloads suspend fun sendGroupAIRecord(groupId: Long, character: AIRecordCharacter, text: String, chatType: UInt = 1u) { this.sendGroupAIRecord(groupId, character.characterId, text, chatType) } @@ -1300,7 +1275,6 @@ class OneBotAction internal constructor( * 该方法是NapCatAPI * 用于签名一个小程序卡片 */ - @JvmOverloads suspend fun getMiniAppArk( type: MiniAppArkType, title: String,