From b2bd48cf4948662a1801df4cad12cd7ee2ec22e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 19 Apr 2025 10:58:56 +0800 Subject: [PATCH] Revert "fix:coerce" This reverts commit b190c21ef8bda280bb7d179382b4487ac99095ea. --- src/core/helper/config.ts | 14 +-- .../extends/ClickInlineKeyboardButton.ts | 10 +- src/onebot/action/extends/CreateCollection.ts | 4 +- src/onebot/action/extends/FetchCustomFace.ts | 2 +- src/onebot/action/extends/FetchEmojiLike.ts | 8 +- src/onebot/action/extends/GetAiCharacters.ts | 4 +- .../action/extends/GetCollectionList.ts | 4 +- src/onebot/action/extends/GetGroupInfoEx.ts | 2 +- src/onebot/action/extends/GetMiniAppArk.ts | 44 ++++---- src/onebot/action/extends/GetProfileLike.ts | 6 +- src/onebot/action/extends/GetUserStatus.ts | 2 +- src/onebot/action/extends/MoveGroupFile.ts | 8 +- src/onebot/action/extends/OCRImage.ts | 2 +- src/onebot/action/extends/RenameGroupFile.ts | 8 +- src/onebot/action/extends/SendPacket.ts | 6 +- .../action/extends/SetDiyOnlineStatus.ts | 6 +- src/onebot/action/extends/SetGroupRemark.ts | 4 +- src/onebot/action/extends/SetGroupSign.ts | 2 +- src/onebot/action/extends/SetInputStatus.ts | 4 +- src/onebot/action/extends/SetLongNick.ts | 2 +- src/onebot/action/extends/SetOnlineStatus.ts | 6 +- src/onebot/action/extends/SetQQAvatar.ts | 2 +- src/onebot/action/extends/SetSpecialTitle.ts | 6 +- src/onebot/action/extends/ShareContact.ts | 8 +- src/onebot/action/extends/TransGroupFile.ts | 4 +- .../action/extends/TranslateEnWordToZn.ts | 2 +- src/onebot/action/file/GetFile.ts | 4 +- src/onebot/action/file/GetGroupFileUrl.ts | 4 +- src/onebot/action/file/GetPrivateFileUrl.ts | 2 +- .../action/go-cqhttp/CreateGroupFileFolder.ts | 4 +- .../action/go-cqhttp/DeleteGroupFile.ts | 4 +- .../action/go-cqhttp/DeleteGroupFileFolder.ts | 6 +- src/onebot/action/go-cqhttp/DownloadFile.ts | 8 +- src/onebot/action/go-cqhttp/GetForwardMsg.ts | 4 +- .../action/go-cqhttp/GetFriendMsgHistory.ts | 8 +- .../action/go-cqhttp/GetGroupAtAllRemain.ts | 2 +- .../go-cqhttp/GetGroupFileSystemInfo.ts | 2 +- .../action/go-cqhttp/GetGroupFilesByFolder.ts | 8 +- .../action/go-cqhttp/GetGroupHonorInfo.ts | 2 +- .../action/go-cqhttp/GetGroupMsgHistory.ts | 8 +- .../action/go-cqhttp/GetGroupRootFiles.ts | 4 +- .../action/go-cqhttp/GetStrangerInfo.ts | 4 +- .../go-cqhttp/GoCQHTTPCheckUrlSafely.ts | 2 +- .../action/go-cqhttp/GoCQHTTPDeleteFriend.ts | 8 +- .../action/go-cqhttp/GoCQHTTPGetModelShow.ts | 2 +- .../action/go-cqhttp/SendGroupNotice.ts | 16 +-- .../action/go-cqhttp/SetGroupPortrait.ts | 4 +- src/onebot/action/go-cqhttp/SetQQProfile.ts | 6 +- .../action/go-cqhttp/UploadGroupFile.ts | 10 +- .../action/go-cqhttp/UploadPrivateFile.ts | 6 +- src/onebot/action/group/DelEssenceMsg.ts | 2 +- src/onebot/action/group/DelGroupNotice.ts | 4 +- src/onebot/action/group/GetAiRecord.ts | 6 +- src/onebot/action/group/GetGroupEssence.ts | 2 +- src/onebot/action/group/GetGroupInfo.ts | 2 +- src/onebot/action/group/GetGroupList.ts | 2 +- src/onebot/action/group/GetGroupMemberInfo.ts | 6 +- src/onebot/action/group/GetGroupMemberList.ts | 4 +- src/onebot/action/group/GetGroupNotice.ts | 2 +- src/onebot/action/group/GetGroupShutList.ts | 2 +- src/onebot/action/group/GroupPoke.ts | 4 +- src/onebot/action/group/SendGroupAiRecord.ts | 6 +- src/onebot/action/group/SetEssenceMsg.ts | 2 +- src/onebot/action/group/SetGroupAddRequest.ts | 6 +- src/onebot/action/group/SetGroupAdmin.ts | 6 +- src/onebot/action/group/SetGroupBan.ts | 6 +- src/onebot/action/group/SetGroupCard.ts | 6 +- src/onebot/action/group/SetGroupKick.ts | 6 +- src/onebot/action/group/SetGroupLeave.ts | 4 +- src/onebot/action/group/SetGroupName.ts | 4 +- src/onebot/action/group/SetGroupWholeBan.ts | 4 +- src/onebot/action/msg/DeleteMsg.ts | 2 +- src/onebot/action/msg/ForwardSingleMsg.ts | 6 +- src/onebot/action/msg/GetMsg.ts | 2 +- src/onebot/action/msg/MarkMsgAsRead.ts | 6 +- src/onebot/action/msg/SetMsgEmojiLike.ts | 6 +- src/onebot/action/packet/SendPoke.ts | 4 +- src/onebot/action/system/GetCredentials.ts | 2 +- src/onebot/action/user/FriendPoke.ts | 2 +- src/onebot/action/user/GetCookies.ts | 2 +- src/onebot/action/user/GetFriendList.ts | 2 +- src/onebot/action/user/GetRecentContact.ts | 2 +- src/onebot/action/user/SendLike.ts | 4 +- src/onebot/action/user/SetFriendAddRequest.ts | 6 +- src/onebot/config/config.ts | 106 +++++++++--------- src/onebot/index.ts | 3 +- src/webui/src/helper/config.ts | 10 +- src/webui/src/types/theme.ts | 4 +- 88 files changed, 276 insertions(+), 277 deletions(-) diff --git a/src/core/helper/config.ts b/src/core/helper/config.ts index 94cfbeb5d..6c2300566 100644 --- a/src/core/helper/config.ts +++ b/src/core/helper/config.ts @@ -3,13 +3,13 @@ import { NapCatCore } from '@/core'; import { z } from 'zod'; export const NapcatConfigSchema = z.object({ - fileLog: z.coerce.boolean().default(false), - consoleLog: z.coerce.boolean().default(true), - fileLogLevel: z.coerce.string().default('debug'), - consoleLogLevel: z.coerce.string().default('info'), - packetBackend: z.coerce.string().default('auto'), - packetServer: z.coerce.string().default(''), - o3HookMode: z.coerce.number().default(0), + fileLog: z.boolean().default(false), + consoleLog: z.boolean().default(true), + fileLogLevel: z.string().default('debug'), + consoleLogLevel: z.string().default('info'), + packetBackend: z.string().default('auto'), + packetServer: z.string().default(''), + o3HookMode: z.number().default(0), }); export type NapcatConfig = z.infer; diff --git a/src/onebot/action/extends/ClickInlineKeyboardButton.ts b/src/onebot/action/extends/ClickInlineKeyboardButton.ts index c06947cfd..4e7983f3d 100644 --- a/src/onebot/action/extends/ClickInlineKeyboardButton.ts +++ b/src/onebot/action/extends/ClickInlineKeyboardButton.ts @@ -3,11 +3,11 @@ import { OneBotAction } from '../OneBotAction'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.coerce.string(), - bot_appid: z.coerce.string(), - button_id: z.coerce.string().default(''), - callback_data: z.coerce.string().default(''), - msg_seq: z.coerce.string().default('10086'), + group_id: z.string(), + bot_appid: z.string(), + button_id: z.string().default(''), + callback_data: z.string().default(''), + msg_seq: z.string().default('10086'), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/CreateCollection.ts b/src/onebot/action/extends/CreateCollection.ts index e1c5903ba..ee682241f 100644 --- a/src/onebot/action/extends/CreateCollection.ts +++ b/src/onebot/action/extends/CreateCollection.ts @@ -3,8 +3,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - rawData: z.coerce.string(), - brief: z.coerce.string(), + rawData: z.string(), + brief: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/FetchCustomFace.ts b/src/onebot/action/extends/FetchCustomFace.ts index cd7d76458..78b1800d6 100644 --- a/src/onebot/action/extends/FetchCustomFace.ts +++ b/src/onebot/action/extends/FetchCustomFace.ts @@ -3,7 +3,7 @@ import { OneBotAction } from '@/onebot/action/OneBotAction'; import { ActionName } from '@/onebot/action/router'; const SchemaData = z.object({ - count: z.coerce.number().default(48), + count: z.number().default(48), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/FetchEmojiLike.ts b/src/onebot/action/extends/FetchEmojiLike.ts index 11505d9af..83749d0e8 100644 --- a/src/onebot/action/extends/FetchEmojiLike.ts +++ b/src/onebot/action/extends/FetchEmojiLike.ts @@ -5,10 +5,10 @@ import { MessageUnique } from '@/common/message-unique'; import { type NTQQMsgApi } from '@/core/apis'; const SchemaData = z.object({ - message_id: z.coerce.string(), - emojiId: z.coerce.string(), - emojiType: z.coerce.string(), - count: z.coerce.number().default(20), + message_id: z.string(), + emojiId: z.string(), + emojiType: z.string(), + count: z.number().default(20), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/GetAiCharacters.ts b/src/onebot/action/extends/GetAiCharacters.ts index e2f2045a5..f889e76d8 100644 --- a/src/onebot/action/extends/GetAiCharacters.ts +++ b/src/onebot/action/extends/GetAiCharacters.ts @@ -4,8 +4,8 @@ import { AIVoiceChatType } from '@/core/packet/entities/aiChat'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.coerce.string(), - chat_type: z.coerce.number().default(1), + group_id: z.string(), + chat_type: z.number().default(1), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/GetCollectionList.ts b/src/onebot/action/extends/GetCollectionList.ts index 4399c3493..47fb9c4e2 100644 --- a/src/onebot/action/extends/GetCollectionList.ts +++ b/src/onebot/action/extends/GetCollectionList.ts @@ -4,8 +4,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - category: z.coerce.number(), - count: z.coerce.number().default(1), + category: z.number(), + count: z.number().default(1), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/GetGroupInfoEx.ts b/src/onebot/action/extends/GetGroupInfoEx.ts index 4dcd05ee5..b38f92f84 100644 --- a/src/onebot/action/extends/GetGroupInfoEx.ts +++ b/src/onebot/action/extends/GetGroupInfoEx.ts @@ -2,7 +2,7 @@ import { OneBotAction } from '@/onebot/action/OneBotAction'; import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.coerce.string(), + group_id: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/GetMiniAppArk.ts b/src/onebot/action/extends/GetMiniAppArk.ts index 699d66614..e4d3c1c5c 100644 --- a/src/onebot/action/extends/GetMiniAppArk.ts +++ b/src/onebot/action/extends/GetMiniAppArk.ts @@ -7,30 +7,30 @@ import { z } from 'zod'; const SchemaData = z.union([ z.object({ type: z.union([z.literal('bili'), z.literal('weibo')]), - title: z.coerce.string(), - desc: z.coerce.string(), - picUrl: z.coerce.string(), - jumpUrl: z.coerce.string(), - webUrl: z.coerce.string().optional(), - rawArkData: z.coerce.string().optional() + title: z.string(), + desc: z.string(), + picUrl: z.string(), + jumpUrl: z.string(), + webUrl: z.string().optional(), + rawArkData: z.string().optional() }), z.object({ - title: z.coerce.string(), - desc: z.coerce.string(), - picUrl: z.coerce.string(), - jumpUrl: z.coerce.string(), - iconUrl: z.coerce.string(), - webUrl: z.coerce.string().optional(), - appId: z.coerce.string(), - scene: z.union([z.coerce.number(), z.coerce.string()]), - templateType: z.union([z.coerce.number(), z.coerce.string()]), - businessType: z.union([z.coerce.number(), z.coerce.string()]), - verType: z.union([z.coerce.number(), z.coerce.string()]), - shareType: z.union([z.coerce.number(), z.coerce.string()]), - versionId: z.coerce.string(), - sdkId: z.coerce.string(), - withShareTicket: z.union([z.coerce.number(), z.coerce.string()]), - rawArkData: z.coerce.string().optional() + title: z.string(), + desc: z.string(), + picUrl: z.string(), + jumpUrl: z.string(), + iconUrl: z.string(), + webUrl: z.string().optional(), + appId: z.string(), + scene: z.union([z.number(), z.string()]), + templateType: z.union([z.number(), z.string()]), + businessType: z.union([z.number(), z.string()]), + verType: z.union([z.number(), z.string()]), + shareType: z.union([z.number(), z.string()]), + versionId: z.string(), + sdkId: z.string(), + withShareTicket: z.union([z.number(), z.string()]), + rawArkData: z.string().optional() }) ]); type Payload = z.infer; diff --git a/src/onebot/action/extends/GetProfileLike.ts b/src/onebot/action/extends/GetProfileLike.ts index 7e727a7a6..e9b75812d 100644 --- a/src/onebot/action/extends/GetProfileLike.ts +++ b/src/onebot/action/extends/GetProfileLike.ts @@ -4,9 +4,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.coerce.string().optional(), - start: z.coerce.number().default(0), - count: z.coerce.number().default(10), + user_id: z.string().optional(), + start: z.number().default(0), + count: z.number().default(10), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/GetUserStatus.ts b/src/onebot/action/extends/GetUserStatus.ts index 7fe274e8f..c090cc3a0 100644 --- a/src/onebot/action/extends/GetUserStatus.ts +++ b/src/onebot/action/extends/GetUserStatus.ts @@ -3,7 +3,7 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.coerce.number(), + user_id: z.number(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/MoveGroupFile.ts b/src/onebot/action/extends/MoveGroupFile.ts index 7e8e6f89f..31856e096 100644 --- a/src/onebot/action/extends/MoveGroupFile.ts +++ b/src/onebot/action/extends/MoveGroupFile.ts @@ -4,10 +4,10 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - file_id: z.coerce.string(), - current_parent_directory: z.coerce.string(), - target_parent_directory: z.coerce.string(), + group_id: z.union([z.number(), z.string()]), + file_id: z.string(), + current_parent_directory: z.string(), + target_parent_directory: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/OCRImage.ts b/src/onebot/action/extends/OCRImage.ts index d3dd45a8b..73776de81 100644 --- a/src/onebot/action/extends/OCRImage.ts +++ b/src/onebot/action/extends/OCRImage.ts @@ -6,7 +6,7 @@ import { z } from 'zod'; import { GeneralCallResultStatus } from '@/core'; const SchemaData = z.object({ - image: z.coerce.string(), + image: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/RenameGroupFile.ts b/src/onebot/action/extends/RenameGroupFile.ts index 918bcfd21..69b4e9f61 100644 --- a/src/onebot/action/extends/RenameGroupFile.ts +++ b/src/onebot/action/extends/RenameGroupFile.ts @@ -4,10 +4,10 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - file_id: z.coerce.string(), - current_parent_directory: z.coerce.string(), - new_name: z.coerce.string(), + group_id: z.union([z.number(), z.string()]), + file_id: z.string(), + current_parent_directory: z.string(), + new_name: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SendPacket.ts b/src/onebot/action/extends/SendPacket.ts index ac23b9c4a..a43b894ef 100644 --- a/src/onebot/action/extends/SendPacket.ts +++ b/src/onebot/action/extends/SendPacket.ts @@ -4,9 +4,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - cmd: z.coerce.string(), - data: z.coerce.string(), - rsp: z.coerce.boolean().default(true), + cmd: z.string(), + data: z.string(), + rsp: z.boolean().default(true), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetDiyOnlineStatus.ts b/src/onebot/action/extends/SetDiyOnlineStatus.ts index c7962d62a..2c1110ac2 100644 --- a/src/onebot/action/extends/SetDiyOnlineStatus.ts +++ b/src/onebot/action/extends/SetDiyOnlineStatus.ts @@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - face_id: z.union([z.coerce.number(), z.coerce.string()]),// 参考 face_config.json 的 QSid - face_type: z.union([z.coerce.number(), z.coerce.string()]).default('1'), - wording: z.coerce.string().default(' '), + face_id: z.union([z.number(), z.string()]),// 参考 face_config.json 的 QSid + face_type: z.union([z.number(), z.string()]).default('1'), + wording: z.string().default(' '), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetGroupRemark.ts b/src/onebot/action/extends/SetGroupRemark.ts index a6e5edaf2..cd26beb3f 100644 --- a/src/onebot/action/extends/SetGroupRemark.ts +++ b/src/onebot/action/extends/SetGroupRemark.ts @@ -3,8 +3,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.coerce.string(), - remark: z.coerce.string(), + group_id: z.string(), + remark: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetGroupSign.ts b/src/onebot/action/extends/SetGroupSign.ts index 67687b341..9bc0775a8 100644 --- a/src/onebot/action/extends/SetGroupSign.ts +++ b/src/onebot/action/extends/SetGroupSign.ts @@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetInputStatus.ts b/src/onebot/action/extends/SetInputStatus.ts index 397957e6a..df8cfef5d 100644 --- a/src/onebot/action/extends/SetInputStatus.ts +++ b/src/onebot/action/extends/SetInputStatus.ts @@ -4,8 +4,8 @@ import { ChatType } from '@/core'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.union([z.coerce.number(), z.coerce.string()]), - event_type: z.coerce.number(), + user_id: z.union([z.number(), z.string()]), + event_type: z.number(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetLongNick.ts b/src/onebot/action/extends/SetLongNick.ts index be68fea28..4403d6076 100644 --- a/src/onebot/action/extends/SetLongNick.ts +++ b/src/onebot/action/extends/SetLongNick.ts @@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - longNick: z.coerce.string(), + longNick: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetOnlineStatus.ts b/src/onebot/action/extends/SetOnlineStatus.ts index 530518241..999ee261f 100644 --- a/src/onebot/action/extends/SetOnlineStatus.ts +++ b/src/onebot/action/extends/SetOnlineStatus.ts @@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - status: z.union([z.coerce.number(), z.coerce.string()]), - ext_status: z.union([z.coerce.number(), z.coerce.string()]), - battery_status: z.union([z.coerce.number(), z.coerce.string()]), + status: z.union([z.number(), z.string()]), + ext_status: z.union([z.number(), z.string()]), + battery_status: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetQQAvatar.ts b/src/onebot/action/extends/SetQQAvatar.ts index eee209c85..5fb8b50fb 100644 --- a/src/onebot/action/extends/SetQQAvatar.ts +++ b/src/onebot/action/extends/SetQQAvatar.ts @@ -5,7 +5,7 @@ import { checkFileExist, uriToLocalFile } from '@/common/file'; import { z } from 'zod'; const SchemaData = z.object({ - file: z.coerce.string(), + file: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/SetSpecialTitle.ts b/src/onebot/action/extends/SetSpecialTitle.ts index 88c81e4fc..6193f2e22 100644 --- a/src/onebot/action/extends/SetSpecialTitle.ts +++ b/src/onebot/action/extends/SetSpecialTitle.ts @@ -3,9 +3,9 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - user_id: z.union([z.coerce.number(), z.coerce.string()]), - special_title: z.coerce.string().default(''), + group_id: z.union([z.number(), z.string()]), + user_id: z.union([z.number(), z.string()]), + special_title: z.string().default(''), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/ShareContact.ts b/src/onebot/action/extends/ShareContact.ts index 6194b4452..edf18ecb2 100644 --- a/src/onebot/action/extends/ShareContact.ts +++ b/src/onebot/action/extends/ShareContact.ts @@ -4,9 +4,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.union([z.coerce.number(), z.coerce.string()]).optional(), - group_id: z.union([z.coerce.number(), z.coerce.string()]).optional(), - phoneNumber: z.coerce.string().default(''), + user_id: z.union([z.number(), z.string()]).optional(), + group_id: z.union([z.number(), z.string()]).optional(), + phoneNumber: z.string().default(''), }); type Payload = z.infer; @@ -29,7 +29,7 @@ export class SharePeer extends OneBotAction; diff --git a/src/onebot/action/extends/TransGroupFile.ts b/src/onebot/action/extends/TransGroupFile.ts index c7b1f7bfc..746c190d3 100644 --- a/src/onebot/action/extends/TransGroupFile.ts +++ b/src/onebot/action/extends/TransGroupFile.ts @@ -4,8 +4,8 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - file_id: z.coerce.string(), + group_id: z.union([z.number(), z.string()]), + file_id: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/extends/TranslateEnWordToZn.ts b/src/onebot/action/extends/TranslateEnWordToZn.ts index bc4977b25..7d3606525 100644 --- a/src/onebot/action/extends/TranslateEnWordToZn.ts +++ b/src/onebot/action/extends/TranslateEnWordToZn.ts @@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - words: z.array(z.coerce.string()), + words: z.array(z.string()), }); type Payload = z.infer; diff --git a/src/onebot/action/file/GetFile.ts b/src/onebot/action/file/GetFile.ts index 8d373676b..d2d87fa19 100644 --- a/src/onebot/action/file/GetFile.ts +++ b/src/onebot/action/file/GetFile.ts @@ -14,8 +14,8 @@ export interface GetFileResponse { } const GetFileBase_PayloadSchema = z.object({ - file: z.coerce.string().optional(), - file_id: z.coerce.string().optional(), + file: z.string().optional(), + file_id: z.string().optional(), }); diff --git a/src/onebot/action/file/GetGroupFileUrl.ts b/src/onebot/action/file/GetGroupFileUrl.ts index f191a1121..ebf28021c 100644 --- a/src/onebot/action/file/GetGroupFileUrl.ts +++ b/src/onebot/action/file/GetGroupFileUrl.ts @@ -4,8 +4,8 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - file_id: z.coerce.string(), + group_id: z.union([z.number(), z.string()]), + file_id: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/file/GetPrivateFileUrl.ts b/src/onebot/action/file/GetPrivateFileUrl.ts index f2ea65e3f..4504cc20b 100644 --- a/src/onebot/action/file/GetPrivateFileUrl.ts +++ b/src/onebot/action/file/GetPrivateFileUrl.ts @@ -4,7 +4,7 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - file_id: z.coerce.string(), + file_id: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/CreateGroupFileFolder.ts b/src/onebot/action/go-cqhttp/CreateGroupFileFolder.ts index 900e7b74c..4a0dea638 100644 --- a/src/onebot/action/go-cqhttp/CreateGroupFileFolder.ts +++ b/src/onebot/action/go-cqhttp/CreateGroupFileFolder.ts @@ -3,8 +3,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - folder_name: z.coerce.string(), + group_id: z.union([z.number(), z.string()]), + folder_name: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/DeleteGroupFile.ts b/src/onebot/action/go-cqhttp/DeleteGroupFile.ts index 80c712472..84343f543 100644 --- a/src/onebot/action/go-cqhttp/DeleteGroupFile.ts +++ b/src/onebot/action/go-cqhttp/DeleteGroupFile.ts @@ -6,8 +6,8 @@ import { z } from 'zod'; import { NTQQGroupApi } from '@/core/apis'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - file_id: z.coerce.string(), + group_id: z.union([z.number(), z.string()]), + file_id: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/DeleteGroupFileFolder.ts b/src/onebot/action/go-cqhttp/DeleteGroupFileFolder.ts index 94e5ade5f..6e12986bf 100644 --- a/src/onebot/action/go-cqhttp/DeleteGroupFileFolder.ts +++ b/src/onebot/action/go-cqhttp/DeleteGroupFileFolder.ts @@ -4,9 +4,9 @@ import { z } from 'zod'; import { NTQQGroupApi } from '@/core/apis'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - folder_id: z.coerce.string().optional(), - folder: z.coerce.string().optional(), + group_id: z.union([z.number(), z.string()]), + folder_id: z.string().optional(), + folder: z.string().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/DownloadFile.ts b/src/onebot/action/go-cqhttp/DownloadFile.ts index a5fb72221..30e9685f1 100644 --- a/src/onebot/action/go-cqhttp/DownloadFile.ts +++ b/src/onebot/action/go-cqhttp/DownloadFile.ts @@ -11,10 +11,10 @@ interface FileResponse { } const SchemaData = z.object({ - url: z.coerce.string().optional(), - base64: z.coerce.string().optional(), - name: z.coerce.string().optional(), - headers: z.union([z.coerce.string(), z.array(z.coerce.string())]).optional(), + url: z.string().optional(), + base64: z.string().optional(), + name: z.string().optional(), + headers: z.union([z.string(), z.array(z.string())]).optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GetForwardMsg.ts b/src/onebot/action/go-cqhttp/GetForwardMsg.ts index e85546fed..7cb5ac148 100644 --- a/src/onebot/action/go-cqhttp/GetForwardMsg.ts +++ b/src/onebot/action/go-cqhttp/GetForwardMsg.ts @@ -7,8 +7,8 @@ import { z } from 'zod'; import { isNumeric } from '@/common/helper'; const SchemaData = z.object({ - message_id: z.coerce.string().optional(), - id: z.coerce.string().optional(), + message_id: z.string().optional(), + id: z.string().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts b/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts index 1a585561a..de4044d53 100644 --- a/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts +++ b/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts @@ -10,10 +10,10 @@ interface Response { messages: OB11Message[]; } const SchemaData = z.object({ - user_id: z.union([z.coerce.number(), z.coerce.string()]), - message_seq: z.union([z.coerce.number(), z.coerce.string()]).optional(), - count: z.union([z.coerce.number(), z.coerce.string()]).default(20), - reverseOrder: z.coerce.boolean().default(false) + user_id: z.union([z.number(), z.string()]), + message_seq: z.union([z.number(), z.string()]).optional(), + count: z.union([z.number(), z.string()]).default(20), + reverseOrder: z.boolean().default(false) }); diff --git a/src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts b/src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts index cad70698a..28d63901f 100644 --- a/src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts +++ b/src/onebot/action/go-cqhttp/GetGroupAtAllRemain.ts @@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]) + group_id: z.union([z.number(), z.string()]) }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts b/src/onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts index 81e78e277..8d966d356 100644 --- a/src/onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts +++ b/src/onebot/action/go-cqhttp/GetGroupFileSystemInfo.ts @@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]) + group_id: z.union([z.number(), z.string()]) }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GetGroupFilesByFolder.ts b/src/onebot/action/go-cqhttp/GetGroupFilesByFolder.ts index e366fef3d..5d08bafb4 100644 --- a/src/onebot/action/go-cqhttp/GetGroupFilesByFolder.ts +++ b/src/onebot/action/go-cqhttp/GetGroupFilesByFolder.ts @@ -5,10 +5,10 @@ import { OB11Construct } from '@/onebot/helper/data'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - folder_id: z.coerce.string().optional(), - folder: z.coerce.string().optional(), - file_count: z.union([z.coerce.number(), z.coerce.string()]).default(50), + group_id: z.union([z.number(), z.string()]), + folder_id: z.string().optional(), + folder: z.string().optional(), + file_count: z.union([z.number(), z.string()]).default(50), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts b/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts index 749b9412f..1194b67fd 100644 --- a/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts +++ b/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts @@ -4,7 +4,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]), type: z.nativeEnum(WebHonorType).optional() }); diff --git a/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts b/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts index fff77c918..91cc93bd8 100644 --- a/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts +++ b/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts @@ -11,10 +11,10 @@ interface Response { } const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - message_seq: z.union([z.coerce.number(), z.coerce.string()]).optional(), - count: z.union([z.coerce.number(), z.coerce.string()]).default(20), - reverseOrder: z.coerce.boolean().default(false) + group_id: z.union([z.number(), z.string()]), + message_seq: z.union([z.number(), z.string()]).optional(), + count: z.union([z.number(), z.string()]).default(20), + reverseOrder: z.boolean().default(false) }); diff --git a/src/onebot/action/go-cqhttp/GetGroupRootFiles.ts b/src/onebot/action/go-cqhttp/GetGroupRootFiles.ts index 737d54ec2..b990aec81 100644 --- a/src/onebot/action/go-cqhttp/GetGroupRootFiles.ts +++ b/src/onebot/action/go-cqhttp/GetGroupRootFiles.ts @@ -6,8 +6,8 @@ import { OB11Construct } from '@/onebot/helper/data'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - file_count: z.union([z.coerce.number(), z.coerce.string()]).default(50), + group_id: z.union([z.number(), z.string()]), + file_count: z.union([z.number(), z.string()]).default(50), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts index e0faf91d9..8ac5aae48 100644 --- a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts +++ b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts @@ -6,8 +6,8 @@ import { calcQQLevel } from '@/common/helper'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.union([z.coerce.number(), z.coerce.string()]), - no_cache: z.coerce.boolean().default(false), + user_id: z.union([z.number(), z.string()]), + no_cache: z.boolean().default(false), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts b/src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts index 0f4d4424e..dfded4109 100644 --- a/src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts +++ b/src/onebot/action/go-cqhttp/GoCQHTTPCheckUrlSafely.ts @@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - url: z.coerce.string(), + url: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts b/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts index 3643e5d26..e7ce50c43 100644 --- a/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts +++ b/src/onebot/action/go-cqhttp/GoCQHTTPDeleteFriend.ts @@ -3,10 +3,10 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - friend_id: z.union([z.coerce.string(), z.coerce.number()]).optional(), - user_id: z.union([z.coerce.string(), z.coerce.number()]).optional(), - temp_block: z.coerce.boolean().optional(), - temp_both_del: z.coerce.boolean().optional(), + friend_id: z.union([z.string(), z.number()]).optional(), + user_id: z.union([z.string(), z.number()]).optional(), + temp_block: z.boolean().optional(), + temp_both_del: z.boolean().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts b/src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts index ea791d3e9..1e839fe3d 100644 --- a/src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts +++ b/src/onebot/action/go-cqhttp/GoCQHTTPGetModelShow.ts @@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - model: z.coerce.string(), + model: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/SendGroupNotice.ts b/src/onebot/action/go-cqhttp/SendGroupNotice.ts index b8df9c9ca..4f81313a9 100644 --- a/src/onebot/action/go-cqhttp/SendGroupNotice.ts +++ b/src/onebot/action/go-cqhttp/SendGroupNotice.ts @@ -5,14 +5,14 @@ import { unlink } from 'node:fs/promises'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - content: z.coerce.string(), - image: z.coerce.string().optional(), - pinned: z.union([z.coerce.number(), z.coerce.string()]).default(0), - type: z.union([z.coerce.number(), z.coerce.string()]).default(1), - confirm_required: z.union([z.coerce.number(), z.coerce.string()]).default(1), - is_show_edit_card: z.union([z.coerce.number(), z.coerce.string()]).default(0), - tip_window_type: z.union([z.coerce.number(), z.coerce.string()]).default(0), + group_id: z.union([z.number(), z.string()]), + content: z.string(), + image: z.string().optional(), + pinned: z.union([z.number(), z.string()]).default(0), + type: z.union([z.number(), z.string()]).default(1), + confirm_required: z.union([z.number(), z.string()]).default(1), + is_show_edit_card: z.union([z.number(), z.string()]).default(0), + tip_window_type: z.union([z.number(), z.string()]).default(0), }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/SetGroupPortrait.ts b/src/onebot/action/go-cqhttp/SetGroupPortrait.ts index c82b11b2b..765c9897e 100644 --- a/src/onebot/action/go-cqhttp/SetGroupPortrait.ts +++ b/src/onebot/action/go-cqhttp/SetGroupPortrait.ts @@ -5,8 +5,8 @@ import { z } from 'zod'; import fs from 'node:fs/promises'; import { GeneralCallResult } from '@/core'; const SchemaData = z.object({ - file: z.coerce.string(), - group_id: z.union([z.coerce.number(), z.coerce.string()]) + file: z.string(), + group_id: z.union([z.number(), z.string()]) }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/SetQQProfile.ts b/src/onebot/action/go-cqhttp/SetQQProfile.ts index 40ca8fe3a..c85e4aa4e 100644 --- a/src/onebot/action/go-cqhttp/SetQQProfile.ts +++ b/src/onebot/action/go-cqhttp/SetQQProfile.ts @@ -4,9 +4,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - nickname: z.coerce.string(), - personal_note: z.coerce.string().optional(), - sex: z.union([z.coerce.number(), z.coerce.string()]).optional(), // 传Sex值?建议传0 + nickname: z.string(), + personal_note: z.string().optional(), + sex: z.union([z.number(), z.string()]).optional(), // 传Sex值?建议传0 }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/UploadGroupFile.ts b/src/onebot/action/go-cqhttp/UploadGroupFile.ts index e9903f0ff..39327cde7 100644 --- a/src/onebot/action/go-cqhttp/UploadGroupFile.ts +++ b/src/onebot/action/go-cqhttp/UploadGroupFile.ts @@ -7,11 +7,11 @@ import { SendMessageContext } from '@/onebot/api'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - file: z.coerce.string(), - name: z.coerce.string(), - folder: z.coerce.string().optional(), - folder_id: z.coerce.string().optional(),//临时扩展 + group_id: z.union([z.number(), z.string()]), + file: z.string(), + name: z.string(), + folder: z.string().optional(), + folder_id: z.string().optional(),//临时扩展 }); type Payload = z.infer; diff --git a/src/onebot/action/go-cqhttp/UploadPrivateFile.ts b/src/onebot/action/go-cqhttp/UploadPrivateFile.ts index f43a32231..8cee2010e 100644 --- a/src/onebot/action/go-cqhttp/UploadPrivateFile.ts +++ b/src/onebot/action/go-cqhttp/UploadPrivateFile.ts @@ -8,9 +8,9 @@ import { ContextMode, createContext } from '@/onebot/action/msg/SendMsg'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.union([z.coerce.number(), z.coerce.string()]), - file: z.coerce.string(), - name: z.coerce.string(), + user_id: z.union([z.number(), z.string()]), + file: z.string(), + name: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/group/DelEssenceMsg.ts b/src/onebot/action/group/DelEssenceMsg.ts index 644e5dbfb..b799b6514 100644 --- a/src/onebot/action/group/DelEssenceMsg.ts +++ b/src/onebot/action/group/DelEssenceMsg.ts @@ -4,7 +4,7 @@ import { MessageUnique } from '@/common/message-unique'; import { z } from 'zod'; const SchemaData = z.object({ - message_id: z.union([z.coerce.number(), z.coerce.string()]), + message_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/group/DelGroupNotice.ts b/src/onebot/action/group/DelGroupNotice.ts index 5668414cb..bd2dae0a1 100644 --- a/src/onebot/action/group/DelGroupNotice.ts +++ b/src/onebot/action/group/DelGroupNotice.ts @@ -3,8 +3,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - notice_id: z.coerce.string() + group_id: z.union([z.number(), z.string()]), + notice_id: z.string() }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetAiRecord.ts b/src/onebot/action/group/GetAiRecord.ts index 86deeca0b..ba30f9d96 100644 --- a/src/onebot/action/group/GetAiRecord.ts +++ b/src/onebot/action/group/GetAiRecord.ts @@ -4,9 +4,9 @@ import { AIVoiceChatType } from '@/core/packet/entities/aiChat'; import { z } from 'zod'; const SchemaData = z.object({ - character: z.coerce.string(), - group_id: z.union([z.coerce.number(), z.coerce.string()]), - text: z.coerce.string(), + character: z.string(), + group_id: z.union([z.number(), z.string()]), + text: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetGroupEssence.ts b/src/onebot/action/group/GetGroupEssence.ts index 4f284e6ff..9ce8c310f 100644 --- a/src/onebot/action/group/GetGroupEssence.ts +++ b/src/onebot/action/group/GetGroupEssence.ts @@ -7,7 +7,7 @@ import { z } from 'zod'; import { NetworkAdapterConfig } from '@/onebot/config/config'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetGroupInfo.ts b/src/onebot/action/group/GetGroupInfo.ts index 1b8a3e64f..2bb5ff724 100644 --- a/src/onebot/action/group/GetGroupInfo.ts +++ b/src/onebot/action/group/GetGroupInfo.ts @@ -5,7 +5,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetGroupList.ts b/src/onebot/action/group/GetGroupList.ts index 0b219646f..5ed487b92 100644 --- a/src/onebot/action/group/GetGroupList.ts +++ b/src/onebot/action/group/GetGroupList.ts @@ -5,7 +5,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - no_cache: z.coerce.boolean().default(false), + no_cache: z.boolean().default(false), }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetGroupMemberInfo.ts b/src/onebot/action/group/GetGroupMemberInfo.ts index ac14e3a93..758340496 100644 --- a/src/onebot/action/group/GetGroupMemberInfo.ts +++ b/src/onebot/action/group/GetGroupMemberInfo.ts @@ -5,9 +5,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - user_id: z.union([z.coerce.number(), z.coerce.string()]), - no_cache: z.coerce.boolean().default(false), + group_id: z.union([z.number(), z.string()]), + user_id: z.union([z.number(), z.string()]), + no_cache: z.boolean().default(false), }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetGroupMemberList.ts b/src/onebot/action/group/GetGroupMemberList.ts index 3afca128a..efd5073cb 100644 --- a/src/onebot/action/group/GetGroupMemberList.ts +++ b/src/onebot/action/group/GetGroupMemberList.ts @@ -6,8 +6,8 @@ import { z } from 'zod'; import { GroupMember } from '@/core'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - no_cache: z.coerce.boolean().default(false) + group_id: z.union([z.number(), z.string()]), + no_cache: z.boolean().default(false) }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetGroupNotice.ts b/src/onebot/action/group/GetGroupNotice.ts index 2a1cf2cf5..317d712c9 100644 --- a/src/onebot/action/group/GetGroupNotice.ts +++ b/src/onebot/action/group/GetGroupNotice.ts @@ -17,7 +17,7 @@ interface GroupNotice { } const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/group/GetGroupShutList.ts b/src/onebot/action/group/GetGroupShutList.ts index e48d25aed..3e82f5e33 100644 --- a/src/onebot/action/group/GetGroupShutList.ts +++ b/src/onebot/action/group/GetGroupShutList.ts @@ -4,7 +4,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/group/GroupPoke.ts b/src/onebot/action/group/GroupPoke.ts index 084effb1b..c318211c0 100644 --- a/src/onebot/action/group/GroupPoke.ts +++ b/src/onebot/action/group/GroupPoke.ts @@ -3,8 +3,8 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - user_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]), + user_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SendGroupAiRecord.ts b/src/onebot/action/group/SendGroupAiRecord.ts index 88ed5118b..1e0c3a038 100644 --- a/src/onebot/action/group/SendGroupAiRecord.ts +++ b/src/onebot/action/group/SendGroupAiRecord.ts @@ -4,9 +4,9 @@ import { AIVoiceChatType } from '@/core/packet/entities/aiChat'; import { z } from 'zod'; const SchemaData = z.object({ - character: z.coerce.string(), - group_id: z.union([z.coerce.number(), z.coerce.string()]), - text: z.coerce.string(), + character: z.string(), + group_id: z.union([z.number(), z.string()]), + text: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetEssenceMsg.ts b/src/onebot/action/group/SetEssenceMsg.ts index 998f3e0b0..a75d27a39 100644 --- a/src/onebot/action/group/SetEssenceMsg.ts +++ b/src/onebot/action/group/SetEssenceMsg.ts @@ -4,7 +4,7 @@ import { MessageUnique } from '@/common/message-unique'; import { z } from 'zod'; const SchemaData = z.object({ - message_id: z.union([z.coerce.number(), z.coerce.string()]), + message_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupAddRequest.ts b/src/onebot/action/group/SetGroupAddRequest.ts index 1bae2c487..8a5834e0a 100644 --- a/src/onebot/action/group/SetGroupAddRequest.ts +++ b/src/onebot/action/group/SetGroupAddRequest.ts @@ -4,9 +4,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - flag: z.union([z.coerce.string(), z.coerce.number()]), - approve: z.coerce.boolean().default(true), - reason: z.union([z.coerce.string(), z.null()]).default(' '), + flag: z.union([z.string(), z.number()]), + approve: z.boolean().default(true), + reason: z.union([z.string(), z.null()]).default(' '), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupAdmin.ts b/src/onebot/action/group/SetGroupAdmin.ts index 97afba3b6..6ad18f06f 100644 --- a/src/onebot/action/group/SetGroupAdmin.ts +++ b/src/onebot/action/group/SetGroupAdmin.ts @@ -4,9 +4,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - user_id: z.union([z.coerce.number(), z.coerce.string()]), - enable: z.coerce.boolean().default(false), + group_id: z.union([z.number(), z.string()]), + user_id: z.union([z.number(), z.string()]), + enable: z.boolean().default(false), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupBan.ts b/src/onebot/action/group/SetGroupBan.ts index 37fe04845..4312e6289 100644 --- a/src/onebot/action/group/SetGroupBan.ts +++ b/src/onebot/action/group/SetGroupBan.ts @@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - user_id: z.union([z.coerce.number(), z.coerce.string()]), - duration: z.union([z.coerce.number(), z.coerce.string()]).default(0), + group_id: z.union([z.number(), z.string()]), + user_id: z.union([z.number(), z.string()]), + duration: z.union([z.number(), z.string()]).default(0), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupCard.ts b/src/onebot/action/group/SetGroupCard.ts index 1d4e59ca8..bd45f957c 100644 --- a/src/onebot/action/group/SetGroupCard.ts +++ b/src/onebot/action/group/SetGroupCard.ts @@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - user_id: z.union([z.coerce.number(), z.coerce.string()]), - card: z.coerce.string().optional(), + group_id: z.union([z.number(), z.string()]), + user_id: z.union([z.number(), z.string()]), + card: z.string().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupKick.ts b/src/onebot/action/group/SetGroupKick.ts index 98fa39e8d..3967ad960 100644 --- a/src/onebot/action/group/SetGroupKick.ts +++ b/src/onebot/action/group/SetGroupKick.ts @@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - user_id: z.union([z.coerce.number(), z.coerce.string()]), - reject_add_request: z.union([z.coerce.boolean(), z.coerce.string()]).optional(), + group_id: z.union([z.number(), z.string()]), + user_id: z.union([z.number(), z.string()]), + reject_add_request: z.union([z.boolean(), z.string()]).optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupLeave.ts b/src/onebot/action/group/SetGroupLeave.ts index 3cf7cd31a..6930af12b 100644 --- a/src/onebot/action/group/SetGroupLeave.ts +++ b/src/onebot/action/group/SetGroupLeave.ts @@ -3,8 +3,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - is_dismiss: z.coerce.boolean().optional(), + group_id: z.union([z.number(), z.string()]), + is_dismiss: z.boolean().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupName.ts b/src/onebot/action/group/SetGroupName.ts index 61ebc27cf..d19e9782d 100644 --- a/src/onebot/action/group/SetGroupName.ts +++ b/src/onebot/action/group/SetGroupName.ts @@ -4,8 +4,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - group_name: z.coerce.string(), + group_id: z.union([z.number(), z.string()]), + group_name: z.string(), }); type Payload = z.infer; diff --git a/src/onebot/action/group/SetGroupWholeBan.ts b/src/onebot/action/group/SetGroupWholeBan.ts index 75ce019c1..dc1ee1a32 100644 --- a/src/onebot/action/group/SetGroupWholeBan.ts +++ b/src/onebot/action/group/SetGroupWholeBan.ts @@ -3,8 +3,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]), - enable: z.union([z.coerce.boolean(), z.coerce.string()]).optional(), + group_id: z.union([z.number(), z.string()]), + enable: z.union([z.boolean(), z.string()]).optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/msg/DeleteMsg.ts b/src/onebot/action/msg/DeleteMsg.ts index e6a345d76..9aa67a304 100644 --- a/src/onebot/action/msg/DeleteMsg.ts +++ b/src/onebot/action/msg/DeleteMsg.ts @@ -4,7 +4,7 @@ import { MessageUnique } from '@/common/message-unique'; import { z } from 'zod'; const SchemaData = z.object({ - message_id: z.union([z.coerce.number(), z.coerce.string()]), + message_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/msg/ForwardSingleMsg.ts b/src/onebot/action/msg/ForwardSingleMsg.ts index b2a5f940e..bc2f5546a 100644 --- a/src/onebot/action/msg/ForwardSingleMsg.ts +++ b/src/onebot/action/msg/ForwardSingleMsg.ts @@ -5,9 +5,9 @@ import { MessageUnique } from '@/common/message-unique'; import { z } from 'zod'; const SchemaData = z.object({ - message_id: z.union([z.coerce.number(), z.coerce.string()]), - group_id: z.coerce.string().optional(), - user_id: z.coerce.string().optional(), + message_id: z.union([z.number(), z.string()]), + group_id: z.string().optional(), + user_id: z.string().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/msg/GetMsg.ts b/src/onebot/action/msg/GetMsg.ts index da3248444..28cc629a9 100644 --- a/src/onebot/action/msg/GetMsg.ts +++ b/src/onebot/action/msg/GetMsg.ts @@ -9,7 +9,7 @@ import { NetworkAdapterConfig } from '@/onebot/config/config'; export type ReturnDataType = OB11Message const SchemaData = z.object({ - message_id: z.union([z.coerce.number(), z.coerce.string()]), + message_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/msg/MarkMsgAsRead.ts b/src/onebot/action/msg/MarkMsgAsRead.ts index 655064450..98f5a9cf3 100644 --- a/src/onebot/action/msg/MarkMsgAsRead.ts +++ b/src/onebot/action/msg/MarkMsgAsRead.ts @@ -5,9 +5,9 @@ import { MessageUnique } from '@/common/message-unique'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.union([z.coerce.string(), z.coerce.number()]).optional(), - group_id: z.union([z.coerce.string(), z.coerce.number()]).optional(), - message_id: z.union([z.coerce.string(), z.coerce.number()]).optional(), + user_id: z.union([z.string(), z.number()]).optional(), + group_id: z.union([z.string(), z.number()]).optional(), + message_id: z.union([z.string(), z.number()]).optional(), }); type PlayloadType = z.infer; diff --git a/src/onebot/action/msg/SetMsgEmojiLike.ts b/src/onebot/action/msg/SetMsgEmojiLike.ts index 7f4e173a7..b7ddf5800 100644 --- a/src/onebot/action/msg/SetMsgEmojiLike.ts +++ b/src/onebot/action/msg/SetMsgEmojiLike.ts @@ -4,9 +4,9 @@ import { MessageUnique } from '@/common/message-unique'; import { z } from 'zod'; const SchemaData = z.object({ - message_id: z.union([z.coerce.number(), z.coerce.string()]), - emoji_id: z.union([z.coerce.number(), z.coerce.string()]), - set: z.coerce.boolean().optional(), + message_id: z.union([z.number(), z.string()]), + emoji_id: z.union([z.number(), z.string()]), + set: z.boolean().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/packet/SendPoke.ts b/src/onebot/action/packet/SendPoke.ts index c362cc8f3..7334219f9 100644 --- a/src/onebot/action/packet/SendPoke.ts +++ b/src/onebot/action/packet/SendPoke.ts @@ -3,8 +3,8 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - group_id: z.union([z.coerce.number(), z.coerce.string()]).optional(), - user_id: z.union([z.coerce.number(), z.coerce.string()]), + group_id: z.union([z.number(), z.string()]).optional(), + user_id: z.union([z.number(), z.string()]), }); type Payload = z.infer; diff --git a/src/onebot/action/system/GetCredentials.ts b/src/onebot/action/system/GetCredentials.ts index 0d6a72fb1..a8d50e164 100644 --- a/src/onebot/action/system/GetCredentials.ts +++ b/src/onebot/action/system/GetCredentials.ts @@ -8,7 +8,7 @@ interface Response { } const SchemaData = z.object({ - domain: z.coerce.string() + domain: z.string() }); type Payload = z.infer; diff --git a/src/onebot/action/user/FriendPoke.ts b/src/onebot/action/user/FriendPoke.ts index 625eaa169..644763ebe 100644 --- a/src/onebot/action/user/FriendPoke.ts +++ b/src/onebot/action/user/FriendPoke.ts @@ -3,7 +3,7 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus'; import { z } from 'zod'; const SchemaData = z.object({ - user_id: z.union([z.coerce.number(), z.coerce.string()]) + user_id: z.union([z.number(), z.string()]) }); type Payload = z.infer; diff --git a/src/onebot/action/user/GetCookies.ts b/src/onebot/action/user/GetCookies.ts index 82df5bccb..bc3e34e06 100644 --- a/src/onebot/action/user/GetCookies.ts +++ b/src/onebot/action/user/GetCookies.ts @@ -7,7 +7,7 @@ interface Response { } const SchemaData = z.object({ - domain: z.coerce.string() + domain: z.string() }); type Payload = z.infer; diff --git a/src/onebot/action/user/GetFriendList.ts b/src/onebot/action/user/GetFriendList.ts index e804bf1c1..227ca12f9 100644 --- a/src/onebot/action/user/GetFriendList.ts +++ b/src/onebot/action/user/GetFriendList.ts @@ -5,7 +5,7 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - no_cache: z.coerce.boolean().optional(), + no_cache: z.boolean().optional(), }); type Payload = z.infer; diff --git a/src/onebot/action/user/GetRecentContact.ts b/src/onebot/action/user/GetRecentContact.ts index b79d7aec5..01b3fc0f6 100644 --- a/src/onebot/action/user/GetRecentContact.ts +++ b/src/onebot/action/user/GetRecentContact.ts @@ -5,7 +5,7 @@ import { NetworkAdapterConfig } from '@/onebot/config/config'; import { z } from 'zod'; const SchemaData = z.object({ - count: z.coerce.number().default(10), + count: z.number().default(10), }); type Payload = z.infer; diff --git a/src/onebot/action/user/SendLike.ts b/src/onebot/action/user/SendLike.ts index 215d24404..04b719c01 100644 --- a/src/onebot/action/user/SendLike.ts +++ b/src/onebot/action/user/SendLike.ts @@ -3,8 +3,8 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - times: z.union([z.coerce.number(), z.coerce.string()]).default(1), - user_id: z.union([z.coerce.number(), z.coerce.string()]) + times: z.union([z.number(), z.string()]).default(1), + user_id: z.union([z.number(), z.string()]) }); type Payload = z.infer; diff --git a/src/onebot/action/user/SetFriendAddRequest.ts b/src/onebot/action/user/SetFriendAddRequest.ts index 070901c98..72551a9ed 100644 --- a/src/onebot/action/user/SetFriendAddRequest.ts +++ b/src/onebot/action/user/SetFriendAddRequest.ts @@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router'; import { z } from 'zod'; const SchemaData = z.object({ - flag: z.union([z.coerce.string(), z.coerce.number()]), - approve: z.union([z.coerce.string(), z.coerce.boolean()]).default(true), - remark: z.union([z.coerce.string(), z.null()]).nullable().optional() + flag: z.union([z.string(), z.number()]), + approve: z.union([z.string(), z.boolean()]).default(true), + remark: z.union([z.string(), z.null()]).nullable().optional() }); type Payload = z.infer; diff --git a/src/onebot/config/config.ts b/src/onebot/config/config.ts index 9a9b8a00f..ffc293391 100644 --- a/src/onebot/config/config.ts +++ b/src/onebot/config/config.ts @@ -1,71 +1,71 @@ import { z } from 'zod'; const HttpServerConfigSchema = z.object({ - name: z.coerce.string().default('http-server'), - enable: z.coerce.boolean().default(false), - port: z.coerce.number().default(3000), - host: z.coerce.string().default('0.0.0.0'), - enableCors: z.coerce.boolean().default(true), - enableWebsocket: z.coerce.boolean().default(true), - messagePostFormat: z.coerce.string().default('array'), - token: z.coerce.string().default(''), - debug: z.coerce.boolean().default(false) + name: z.string().default('http-server'), + enable: z.boolean().default(false), + port: z.number().default(3000), + host: z.string().default('0.0.0.0'), + enableCors: z.boolean().default(true), + enableWebsocket: z.boolean().default(true), + messagePostFormat: z.string().default('array'), + token: z.string().default(''), + debug: z.boolean().default(false) }); const HttpSseServerConfigSchema = z.object({ - name: z.coerce.string().default('http-sse-server'), - enable: z.coerce.boolean().default(false), - port: z.coerce.number().default(3000), - host: z.coerce.string().default('0.0.0.0'), - enableCors: z.coerce.boolean().default(true), - enableWebsocket: z.coerce.boolean().default(true), - messagePostFormat: z.coerce.string().default('array'), - token: z.coerce.string().default(''), - debug: z.coerce.boolean().default(false), - reportSelfMessage: z.coerce.boolean().default(false) + name: z.string().default('http-sse-server'), + enable: z.boolean().default(false), + port: z.number().default(3000), + host: z.string().default('0.0.0.0'), + enableCors: z.boolean().default(true), + enableWebsocket: z.boolean().default(true), + messagePostFormat: z.string().default('array'), + token: z.string().default(''), + debug: z.boolean().default(false), + reportSelfMessage: z.boolean().default(false) }); const HttpClientConfigSchema = z.object({ - name: z.coerce.string().default('http-client'), - enable: z.coerce.boolean().default(false), - url: z.coerce.string().default('http://localhost:8080'), - messagePostFormat: z.coerce.string().default('array'), - reportSelfMessage: z.coerce.boolean().default(false), - token: z.coerce.string().default(''), - debug: z.coerce.boolean().default(false) + name: z.string().default('http-client'), + enable: z.boolean().default(false), + url: z.string().default('http://localhost:8080'), + messagePostFormat: z.string().default('array'), + reportSelfMessage: z.boolean().default(false), + token: z.string().default(''), + debug: z.boolean().default(false) }); const WebsocketServerConfigSchema = z.object({ - name: z.coerce.string().default('websocket-server'), - enable: z.coerce.boolean().default(false), - host: z.coerce.string().default('0.0.0.0'), - port: z.coerce.number().default(3001), - messagePostFormat: z.coerce.string().default('array'), - reportSelfMessage: z.coerce.boolean().default(false), - token: z.coerce.string().default(''), - enableForcePushEvent: z.coerce.boolean().default(true), - debug: z.coerce.boolean().default(false), - heartInterval: z.coerce.number().default(30000) + name: z.string().default('websocket-server'), + enable: z.boolean().default(false), + host: z.string().default('0.0.0.0'), + port: z.number().default(3001), + messagePostFormat: z.string().default('array'), + reportSelfMessage: z.boolean().default(false), + token: z.string().default(''), + enableForcePushEvent: z.boolean().default(true), + debug: z.boolean().default(false), + heartInterval: z.number().default(30000) }); const WebsocketClientConfigSchema = z.object({ - name: z.coerce.string().default('websocket-client'), - enable: z.coerce.boolean().default(false), - url: z.coerce.string().default('ws://localhost:8082'), - messagePostFormat: z.coerce.string().default('array'), - reportSelfMessage: z.coerce.boolean().default(false), - reconnectInterval: z.coerce.number().default(5000), - token: z.coerce.string().default(''), - debug: z.coerce.boolean().default(false), - heartInterval: z.coerce.number().default(30000) + name: z.string().default('websocket-client'), + enable: z.boolean().default(false), + url: z.string().default('ws://localhost:8082'), + messagePostFormat: z.string().default('array'), + reportSelfMessage: z.boolean().default(false), + reconnectInterval: z.number().default(5000), + token: z.string().default(''), + debug: z.boolean().default(false), + heartInterval: z.number().default(30000) }); const PluginConfigSchema = z.object({ - name: z.coerce.string().default('plugin'), - enable: z.coerce.boolean().default(false), - messagePostFormat: z.coerce.string().default('array'), - reportSelfMessage: z.coerce.boolean().default(false), - debug: z.coerce.boolean().default(false), + name: z.string().default('plugin'), + enable: z.boolean().default(false), + messagePostFormat: z.string().default('array'), + reportSelfMessage: z.boolean().default(false), + debug: z.boolean().default(false), }); const NetworkConfigSchema = z.object({ @@ -79,9 +79,9 @@ const NetworkConfigSchema = z.object({ export const OneBotConfigSchema = z.object({ network: NetworkConfigSchema, - musicSignUrl: z.coerce.string().default(''), - enableLocalFile2Url: z.coerce.boolean().default(false), - parseMultMsg: z.coerce.boolean().default(false) + musicSignUrl: z.string().default(''), + enableLocalFile2Url: z.boolean().default(false), + parseMultMsg: z.boolean().default(false) }); export type OneBotConfig = z.infer; diff --git a/src/onebot/index.ts b/src/onebot/index.ts index b6a059622..4fb0089c6 100644 --- a/src/onebot/index.ts +++ b/src/onebot/index.ts @@ -50,7 +50,6 @@ import { import { OB11Message } from './types'; import { IOB11NetworkAdapter } from '@/onebot/network/adapter'; import { OB11HttpSSEServerAdapter } from './network/http-server-sse'; -import { ZodType } from 'zod'; //OneBot实现类 export class NapCatOneBot11Adapter { @@ -67,7 +66,7 @@ export class NapCatOneBot11Adapter { constructor(core: NapCatCore, context: InstanceContext, pathWrapper: NapCatPathWrapper) { this.core = core; this.context = context; - this.configLoader = new OB11ConfigLoader(core, pathWrapper.configPath, OneBotConfigSchema as ZodType); + this.configLoader = new OB11ConfigLoader(core, pathWrapper.configPath, OneBotConfigSchema); this.apis = { GroupApi: new OneBotGroupApi(this, core), UserApi: new OneBotUserApi(this, core), diff --git a/src/webui/src/helper/config.ts b/src/webui/src/helper/config.ts index 065628594..d6455c68d 100644 --- a/src/webui/src/helper/config.ts +++ b/src/webui/src/helper/config.ts @@ -6,11 +6,11 @@ import { themeType } from '../types/theme'; import { z } from 'zod'; // 定义配置的类型 const WebUiConfigSchema = z.object({ - host: z.coerce.string().default('0.0.0.0'), - port: z.coerce.number().default(6099), - token: z.coerce.string().default('napcat'), - loginRate: z.coerce.number().default(10), - autoLoginAccount: z.coerce.string().default(''), + host: z.string().default('0.0.0.0'), + port: z.number().default(6099), + token: z.string().default('napcat'), + loginRate: z.number().default(10), + autoLoginAccount: z.string().default(''), theme: themeType, }); diff --git a/src/webui/src/types/theme.ts b/src/webui/src/types/theme.ts index dcbe3a47a..2c2240237 100644 --- a/src/webui/src/types/theme.ts +++ b/src/webui/src/types/theme.ts @@ -2,8 +2,8 @@ import { z } from 'zod'; export const themeType = z.object( { - dark: z.record(z.coerce.string(), z.coerce.string()), - light: z.record(z.coerce.string(), z.coerce.string()), + dark: z.record(z.string(), z.string()), + light: z.record(z.string(), z.string()), } ).default({ dark: {