mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-11 23:40:24 +00:00
fix: zod boolean强制转换
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { OneBotAction } from '../OneBotAction';
|
||||
import { z } from 'zod';
|
||||
import { actionType } from '../type';
|
||||
|
||||
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: actionType.string(),
|
||||
bot_appid: actionType.string(),
|
||||
button_id: actionType.string().default(''),
|
||||
callback_data: actionType.string().default(''),
|
||||
msg_seq: actionType.string().default('10086'),
|
||||
});
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
rawData: z.coerce.string(),
|
||||
brief: z.coerce.string(),
|
||||
rawData: actionType.string(),
|
||||
brief: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
count: z.coerce.number().default(48),
|
||||
count: actionType.number().default(48),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -3,12 +3,12 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
import { type NTQQMsgApi } from '@/core/apis';
|
||||
|
||||
import { actionType } from '../type';
|
||||
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: actionType.string(),
|
||||
emojiId: actionType.string(),
|
||||
emojiType: actionType.string(),
|
||||
count: actionType.number().default(20),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,10 +2,10 @@ import { ActionName } from '@/onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
chat_type: z.coerce.number().default(1),
|
||||
group_id: actionType.string(),
|
||||
chat_type: actionType.number().default(1),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,10 +2,10 @@ import { type NTQQCollectionApi } from '@/core/apis/collection';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
category: z.coerce.number(),
|
||||
count: z.coerce.number().default(1),
|
||||
category: actionType.number(),
|
||||
count: actionType.number().default(1),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
group_id: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -3,34 +3,34 @@ import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { MiniAppInfo, MiniAppInfoHelper } from '@/core/packet/utils/helper/miniAppHelper';
|
||||
import { MiniAppData, MiniAppRawData, MiniAppReqCustomParams, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
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: actionType.string(),
|
||||
desc: actionType.string(),
|
||||
picUrl: actionType.string(),
|
||||
jumpUrl: actionType.string(),
|
||||
webUrl: actionType.string().optional(),
|
||||
rawArkData: actionType.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: actionType.string(),
|
||||
desc: actionType.string(),
|
||||
picUrl: actionType.string(),
|
||||
jumpUrl: actionType.string(),
|
||||
iconUrl: actionType.string(),
|
||||
webUrl: actionType.string().optional(),
|
||||
appId: actionType.string(),
|
||||
scene: z.union([actionType.number(), actionType.string()]),
|
||||
templateType: z.union([actionType.number(), actionType.string()]),
|
||||
businessType: z.union([actionType.number(), actionType.string()]),
|
||||
verType: z.union([actionType.number(), actionType.string()]),
|
||||
shareType: z.union([actionType.number(), actionType.string()]),
|
||||
versionId: actionType.string(),
|
||||
sdkId: actionType.string(),
|
||||
withShareTicket: z.union([actionType.number(), actionType.string()]),
|
||||
rawArkData: actionType.string().optional()
|
||||
})
|
||||
]);
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,11 +2,11 @@ import { NTVoteInfo } from '@/core';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
user_id: z.coerce.string().optional(),
|
||||
start: z.coerce.number().default(0),
|
||||
count: z.coerce.number().default(10),
|
||||
user_id: actionType.string().optional(),
|
||||
start: actionType.number().default(0),
|
||||
count: actionType.number().default(10),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
user_id: z.coerce.number(),
|
||||
user_id: actionType.number(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,12 +2,12 @@ import { ActionName } from '@/onebot/action/router';
|
||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
file_id: z.coerce.string(),
|
||||
current_parent_directory: z.coerce.string(),
|
||||
target_parent_directory: z.coerce.string(),
|
||||
group_id: actionType.string(),
|
||||
file_id: actionType.string(),
|
||||
current_parent_directory: actionType.string(),
|
||||
target_parent_directory: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -4,9 +4,9 @@ import { checkFileExist, uriToLocalFile } from '@/common/file';
|
||||
import fs from 'fs';
|
||||
import { z } from 'zod';
|
||||
import { GeneralCallResultStatus } from '@/core';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
image: z.coerce.string(),
|
||||
image: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,12 +2,12 @@ import { ActionName } from '@/onebot/action/router';
|
||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
file_id: z.coerce.string(),
|
||||
current_parent_directory: z.coerce.string(),
|
||||
new_name: z.coerce.string(),
|
||||
group_id: actionType.string(),
|
||||
file_id: actionType.string(),
|
||||
current_parent_directory: actionType.string(),
|
||||
new_name: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,11 +2,12 @@ import { PacketHexStr } from '@/core/packet/transformer/base';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
import { actionType } from '../type';
|
||||
|
||||
const SchemaData = z.object({
|
||||
cmd: z.coerce.string(),
|
||||
data: z.coerce.string(),
|
||||
rsp: z.coerce.boolean().default(true),
|
||||
cmd: actionType.string(),
|
||||
data: actionType.string(),
|
||||
rsp: actionType.boolean().default(true),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
face_id: z.coerce.string(),// 参考 face_config.json 的 QSid
|
||||
face_type: z.coerce.string().default('1'),
|
||||
wording: z.coerce.string().default(' '),
|
||||
face_id: actionType.string(),// 参考 face_config.json 的 QSid
|
||||
face_type: actionType.string().default('1'),
|
||||
wording: actionType.string().default(' '),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
remark: z.coerce.string(),
|
||||
group_id: actionType.string(),
|
||||
remark: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
group_id: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,10 +2,10 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { ChatType } from '@/core';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
user_id: z.coerce.string(),
|
||||
event_type: z.coerce.number(),
|
||||
user_id: actionType.string(),
|
||||
event_type: actionType.number(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
longNick: z.coerce.string(),
|
||||
longNick: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
status: z.coerce.number(),
|
||||
ext_status: z.coerce.number(),
|
||||
battery_status: z.coerce.number(),
|
||||
status: actionType.number(),
|
||||
ext_status: actionType.number(),
|
||||
battery_status: actionType.number(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router';
|
||||
import fs from 'node:fs/promises';
|
||||
import { checkFileExist, uriToLocalFile } from '@/common/file';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
file: z.coerce.string(),
|
||||
file: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
user_id: z.coerce.string(),
|
||||
special_title: z.coerce.string().default(''),
|
||||
group_id: actionType.string(),
|
||||
user_id: actionType.string(),
|
||||
special_title: actionType.string().default(''),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -2,11 +2,11 @@ import { GeneralCallResult } from '@/core';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
user_id: z.coerce.string().optional(),
|
||||
group_id: z.coerce.string().optional(),
|
||||
phoneNumber: z.coerce.string().default(''),
|
||||
user_id: actionType.string().optional(),
|
||||
group_id: actionType.string().optional(),
|
||||
phoneNumber: actionType.string().default(''),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
@@ -29,7 +29,7 @@ export class SharePeer extends OneBotAction<Payload, GeneralCallResult & {
|
||||
}
|
||||
|
||||
const SchemaDataGroupEx = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
group_id: actionType.string(),
|
||||
});
|
||||
|
||||
type PayloadGroupEx = z.infer<typeof SchemaDataGroupEx>;
|
||||
|
||||
@@ -2,10 +2,10 @@ import { ActionName } from '@/onebot/action/router';
|
||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
group_id: z.coerce.string(),
|
||||
file_id: z.coerce.string(),
|
||||
group_id: actionType.string(),
|
||||
file_id: actionType.string(),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { actionType } from '../type';
|
||||
const SchemaData = z.object({
|
||||
words: z.array(z.coerce.string()),
|
||||
words: z.array(actionType.string()),
|
||||
});
|
||||
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
Reference in New Issue
Block a user