mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
@@ -11,4 +11,4 @@ const string = () => z.preprocess(
|
|||||||
val => typeof val !== 'string' ? String(val) : val,
|
val => typeof val !== 'string' ? String(val) : val,
|
||||||
z.string()
|
z.string()
|
||||||
);
|
);
|
||||||
export const coerce = { boolean, number, string };
|
export const actionType = { boolean, number, string };
|
@@ -1,16 +1,16 @@
|
|||||||
import { ConfigBase } from '@/common/config-base';
|
import { ConfigBase } from '@/common/config-base';
|
||||||
import { NapCatCore } from '@/core';
|
import { NapCatCore } from '@/core';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
export const NapcatConfigSchema = z.object({
|
export const NapcatConfigSchema = z.object({
|
||||||
fileLog: coerce.boolean().default(false),
|
fileLog: actionType.boolean().default(false),
|
||||||
consoleLog: coerce.boolean().default(true),
|
consoleLog: actionType.boolean().default(true),
|
||||||
fileLogLevel: coerce.string().default('debug'),
|
fileLogLevel: actionType.string().default('debug'),
|
||||||
consoleLogLevel: coerce.string().default('info'),
|
consoleLogLevel: actionType.string().default('info'),
|
||||||
packetBackend: coerce.string().default('auto'),
|
packetBackend: actionType.string().default('auto'),
|
||||||
packetServer: coerce.string().default(''),
|
packetServer: actionType.string().default(''),
|
||||||
o3HookMode: coerce.number().default(0),
|
o3HookMode: actionType.number().default(0),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type NapcatConfig = z.infer<typeof NapcatConfigSchema>;
|
export type NapcatConfig = z.infer<typeof NapcatConfigSchema>;
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { OneBotAction } from '../OneBotAction';
|
import { OneBotAction } from '../OneBotAction';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
bot_appid: coerce.string(),
|
bot_appid: actionType.string(),
|
||||||
button_id: coerce.string().default(''),
|
button_id: actionType.string().default(''),
|
||||||
callback_data: coerce.string().default(''),
|
callback_data: actionType.string().default(''),
|
||||||
msg_seq: coerce.string().default('10086'),
|
msg_seq: actionType.string().default('10086'),
|
||||||
});
|
});
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
rawData: coerce.string(),
|
rawData: actionType.string(),
|
||||||
brief: coerce.string(),
|
brief: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
count: coerce.number().default(48),
|
count: actionType.number().default(48),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,12 +3,12 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { type NTQQMsgApi } from '@/core/apis';
|
import { type NTQQMsgApi } from '@/core/apis';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string(),
|
message_id: actionType.string(),
|
||||||
emojiId: coerce.string(),
|
emojiId: actionType.string(),
|
||||||
emojiType: coerce.string(),
|
emojiType: actionType.string(),
|
||||||
count: coerce.number().default(20),
|
count: actionType.number().default(20),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,10 +2,10 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
chat_type: coerce.number().default(1),
|
chat_type: actionType.number().default(1),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,10 +2,10 @@ import { type NTQQCollectionApi } from '@/core/apis/collection';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
category: coerce.number(),
|
category: actionType.number(),
|
||||||
count: coerce.number().default(1),
|
count: actionType.number().default(1),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
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 { MiniAppInfo, MiniAppInfoHelper } from '@/core/packet/utils/helper/miniAppHelper';
|
||||||
import { MiniAppData, MiniAppRawData, MiniAppReqCustomParams, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
import { MiniAppData, MiniAppRawData, MiniAppReqCustomParams, MiniAppReqParams } from '@/core/packet/entities/miniApp';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.union([
|
const SchemaData = z.union([
|
||||||
z.object({
|
z.object({
|
||||||
type: z.union([z.literal('bili'), z.literal('weibo')]),
|
type: z.union([z.literal('bili'), z.literal('weibo')]),
|
||||||
title: coerce.string(),
|
title: actionType.string(),
|
||||||
desc: coerce.string(),
|
desc: actionType.string(),
|
||||||
picUrl: coerce.string(),
|
picUrl: actionType.string(),
|
||||||
jumpUrl: coerce.string(),
|
jumpUrl: actionType.string(),
|
||||||
webUrl: coerce.string().optional(),
|
webUrl: actionType.string().optional(),
|
||||||
rawArkData: coerce.string().optional()
|
rawArkData: actionType.string().optional()
|
||||||
}),
|
}),
|
||||||
z.object({
|
z.object({
|
||||||
title: coerce.string(),
|
title: actionType.string(),
|
||||||
desc: coerce.string(),
|
desc: actionType.string(),
|
||||||
picUrl: coerce.string(),
|
picUrl: actionType.string(),
|
||||||
jumpUrl: coerce.string(),
|
jumpUrl: actionType.string(),
|
||||||
iconUrl: coerce.string(),
|
iconUrl: actionType.string(),
|
||||||
webUrl: coerce.string().optional(),
|
webUrl: actionType.string().optional(),
|
||||||
appId: coerce.string(),
|
appId: actionType.string(),
|
||||||
scene: z.union([coerce.number(), coerce.string()]),
|
scene: z.union([actionType.number(), actionType.string()]),
|
||||||
templateType: z.union([coerce.number(), coerce.string()]),
|
templateType: z.union([actionType.number(), actionType.string()]),
|
||||||
businessType: z.union([coerce.number(), coerce.string()]),
|
businessType: z.union([actionType.number(), actionType.string()]),
|
||||||
verType: z.union([coerce.number(), coerce.string()]),
|
verType: z.union([actionType.number(), actionType.string()]),
|
||||||
shareType: z.union([coerce.number(), coerce.string()]),
|
shareType: z.union([actionType.number(), actionType.string()]),
|
||||||
versionId: coerce.string(),
|
versionId: actionType.string(),
|
||||||
sdkId: coerce.string(),
|
sdkId: actionType.string(),
|
||||||
withShareTicket: z.union([coerce.number(), coerce.string()]),
|
withShareTicket: z.union([actionType.number(), actionType.string()]),
|
||||||
rawArkData: coerce.string().optional()
|
rawArkData: actionType.string().optional()
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,11 +2,11 @@ import { NTVoteInfo } from '@/core';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string().optional(),
|
user_id: actionType.string().optional(),
|
||||||
start: coerce.number().default(0),
|
start: actionType.number().default(0),
|
||||||
count: coerce.number().default(10),
|
count: actionType.number().default(10),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.number(),
|
user_id: actionType.number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,12 +2,12 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
file_id: coerce.string(),
|
file_id: actionType.string(),
|
||||||
current_parent_directory: coerce.string(),
|
current_parent_directory: actionType.string(),
|
||||||
target_parent_directory: coerce.string(),
|
target_parent_directory: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -4,9 +4,9 @@ import { checkFileExist, uriToLocalFile } from '@/common/file';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { GeneralCallResultStatus } from '@/core';
|
import { GeneralCallResultStatus } from '@/core';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
image: coerce.string(),
|
image: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,12 +2,12 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
file_id: coerce.string(),
|
file_id: actionType.string(),
|
||||||
current_parent_directory: coerce.string(),
|
current_parent_directory: actionType.string(),
|
||||||
new_name: coerce.string(),
|
new_name: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,12 +2,12 @@ import { PacketHexStr } from '@/core/packet/transformer/base';
|
|||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
cmd: coerce.string(),
|
cmd: actionType.string(),
|
||||||
data: coerce.string(),
|
data: actionType.string(),
|
||||||
rsp: coerce.boolean().default(true),
|
rsp: actionType.boolean().default(true),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
face_id: coerce.string(),// 参考 face_config.json 的 QSid
|
face_id: actionType.string(),// 参考 face_config.json 的 QSid
|
||||||
face_type: coerce.string().default('1'),
|
face_type: actionType.string().default('1'),
|
||||||
wording: coerce.string().default(' '),
|
wording: actionType.string().default(' '),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
remark: coerce.string(),
|
remark: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,10 +2,10 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { ChatType } from '@/core';
|
import { ChatType } from '@/core';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
event_type: coerce.number(),
|
event_type: actionType.number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
longNick: coerce.string(),
|
longNick: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
status: coerce.number(),
|
status: actionType.number(),
|
||||||
ext_status: coerce.number(),
|
ext_status: actionType.number(),
|
||||||
battery_status: coerce.number(),
|
battery_status: actionType.number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,9 +3,9 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import { checkFileExist, uriToLocalFile } from '@/common/file';
|
import { checkFileExist, uriToLocalFile } from '@/common/file';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
file: coerce.string(),
|
file: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
special_title: coerce.string().default(''),
|
special_title: actionType.string().default(''),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,11 +2,11 @@ import { GeneralCallResult } from '@/core';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string().optional(),
|
user_id: actionType.string().optional(),
|
||||||
group_id: coerce.string().optional(),
|
group_id: actionType.string().optional(),
|
||||||
phoneNumber: coerce.string().default(''),
|
phoneNumber: actionType.string().default(''),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
@@ -29,7 +29,7 @@ export class SharePeer extends OneBotAction<Payload, GeneralCallResult & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SchemaDataGroupEx = z.object({
|
const SchemaDataGroupEx = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type PayloadGroupEx = z.infer<typeof SchemaDataGroupEx>;
|
type PayloadGroupEx = z.infer<typeof SchemaDataGroupEx>;
|
||||||
|
@@ -2,10 +2,10 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
file_id: coerce.string(),
|
file_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
words: z.array(coerce.string()),
|
words: z.array(actionType.string()),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -4,7 +4,7 @@ import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { OB11MessageImage, OB11MessageVideo } from '@/onebot/types';
|
import { OB11MessageImage, OB11MessageVideo } from '@/onebot/types';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
export interface GetFileResponse {
|
export interface GetFileResponse {
|
||||||
file?: string; // path
|
file?: string; // path
|
||||||
url?: string;
|
url?: string;
|
||||||
@@ -14,8 +14,8 @@ export interface GetFileResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const GetFileBase_PayloadSchema = z.object({
|
const GetFileBase_PayloadSchema = z.object({
|
||||||
file: coerce.string().optional(),
|
file: actionType.string().optional(),
|
||||||
file_id: coerce.string().optional(),
|
file_id: actionType.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,10 +2,10 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
file_id: coerce.string(),
|
file_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,9 +2,9 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
file_id: coerce.string(),
|
file_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
folder_name: coerce.string(),
|
folder_name: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -4,10 +4,10 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
import { FileNapCatOneBotUUID } from '@/common/file-uuid';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { NTQQGroupApi } from '@/core/apis';
|
import { NTQQGroupApi } from '@/core/apis';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
file_id: coerce.string(),
|
file_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,11 +2,11 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { NTQQGroupApi } from '@/core/apis';
|
import { NTQQGroupApi } from '@/core/apis';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
folder_id: coerce.string().optional(),
|
folder_id: actionType.string().optional(),
|
||||||
folder: coerce.string().optional(),
|
folder: actionType.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -5,16 +5,16 @@ import { join as joinPath } from 'node:path';
|
|||||||
import { calculateFileMD5, uriToLocalFile } from '@/common/file';
|
import { calculateFileMD5, uriToLocalFile } from '@/common/file';
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
interface FileResponse {
|
interface FileResponse {
|
||||||
file: string;
|
file: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
url: coerce.string().optional(),
|
url: actionType.string().optional(),
|
||||||
base64: coerce.string().optional(),
|
base64: actionType.string().optional(),
|
||||||
name: coerce.string().optional(),
|
name: actionType.string().optional(),
|
||||||
headers: z.union([coerce.string(), z.array(coerce.string())]).optional(),
|
headers: z.union([actionType.string(), z.array(actionType.string())]).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -5,10 +5,10 @@ import { MessageUnique } from '@/common/message-unique';
|
|||||||
import { ChatType, ElementType, MsgSourceType, NTMsgType, RawMessage } from '@/core';
|
import { ChatType, ElementType, MsgSourceType, NTMsgType, RawMessage } from '@/core';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { isNumeric } from '@/common/helper';
|
import { isNumeric } from '@/common/helper';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string().optional(),
|
message_id: actionType.string().optional(),
|
||||||
id: coerce.string().optional(),
|
id: actionType.string().optional(),
|
||||||
});
|
});
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
|
||||||
|
@@ -5,16 +5,16 @@ import { ChatType } from '@/core/types';
|
|||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
interface Response {
|
interface Response {
|
||||||
messages: OB11Message[];
|
messages: OB11Message[];
|
||||||
}
|
}
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
message_seq: coerce.string().optional(),
|
message_seq: actionType.string().optional(),
|
||||||
count: coerce.number().default(20),
|
count: actionType.number().default(20),
|
||||||
reverseOrder: coerce.boolean().default(false)
|
reverseOrder: actionType.boolean().default(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string()
|
group_id: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string()
|
group_id: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,12 +3,12 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { OB11Construct } from '@/onebot/helper/data';
|
import { OB11Construct } from '@/onebot/helper/data';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
folder_id: coerce.string().optional(),
|
folder_id: actionType.string().optional(),
|
||||||
folder: coerce.string().optional(),
|
folder: actionType.string().optional(),
|
||||||
file_count: coerce.number().default(50),
|
file_count: actionType.number().default(50),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,9 +2,9 @@ import { WebHonorType } from '@/core';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
type: z.nativeEnum(WebHonorType).optional()
|
type: z.nativeEnum(WebHonorType).optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -5,17 +5,17 @@ import { ChatType, Peer } from '@/core/types';
|
|||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
interface Response {
|
interface Response {
|
||||||
messages: OB11Message[];
|
messages: OB11Message[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
message_seq: coerce.string().optional(),
|
message_seq: actionType.string().optional(),
|
||||||
count: coerce.number().default(20),
|
count: actionType.number().default(20),
|
||||||
reverseOrder: coerce.boolean().default(false)
|
reverseOrder: actionType.boolean().default(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,10 +4,10 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { OB11GroupFile, OB11GroupFileFolder } from '@/onebot';
|
import { OB11GroupFile, OB11GroupFileFolder } from '@/onebot';
|
||||||
import { OB11Construct } from '@/onebot/helper/data';
|
import { OB11Construct } from '@/onebot/helper/data';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
file_count: coerce.number().default(50),
|
file_count: actionType.number().default(50),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -4,11 +4,11 @@ import { OB11Construct } from '@/onebot/helper/data';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { calcQQLevel } from '@/common/helper';
|
import { calcQQLevel } from '@/common/helper';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
no_cache: coerce.boolean().default(false),
|
no_cache: actionType.boolean().default(false),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
url: coerce.string(),
|
url: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
friend_id: coerce.string().optional(),
|
friend_id: actionType.string().optional(),
|
||||||
user_id: coerce.string().optional(),
|
user_id: actionType.string().optional(),
|
||||||
temp_block: coerce.boolean().optional(),
|
temp_block: actionType.boolean().optional(),
|
||||||
temp_both_del: coerce.boolean().optional(),
|
temp_both_del: actionType.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
model: coerce.string(),
|
model: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,16 +3,16 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { unlink } from 'node:fs/promises';
|
import { unlink } from 'node:fs/promises';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
content: coerce.string(),
|
content: actionType.string(),
|
||||||
image: coerce.string().optional(),
|
image: actionType.string().optional(),
|
||||||
pinned: coerce.number().default(0),
|
pinned: actionType.number().default(0),
|
||||||
type: coerce.number().default(1),
|
type: actionType.number().default(1),
|
||||||
confirm_required: coerce.number().default(1),
|
confirm_required: actionType.number().default(1),
|
||||||
is_show_edit_card: coerce.number().default(0),
|
is_show_edit_card: actionType.number().default(0),
|
||||||
tip_window_type: coerce.number().default(0),
|
tip_window_type: actionType.number().default(0),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -4,10 +4,10 @@ import { checkFileExistV2, uriToLocalFile } from '@/common/file';
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import { GeneralCallResult } from '@/core';
|
import { GeneralCallResult } from '@/core';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
file: coerce.string(),
|
file: actionType.string(),
|
||||||
group_id: coerce.string()
|
group_id: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,11 +2,11 @@ import { NTQQUserApi } from '@/core/apis';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
nickname: coerce.string(),
|
nickname: actionType.string(),
|
||||||
personal_note: coerce.string().optional(),
|
personal_note: actionType.string().optional(),
|
||||||
sex: coerce.string().optional(), // 传Sex值?建议传0
|
sex: actionType.string().optional(), // 传Sex值?建议传0
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -5,13 +5,13 @@ import fs from 'fs';
|
|||||||
import { uriToLocalFile } from '@/common/file';
|
import { uriToLocalFile } from '@/common/file';
|
||||||
import { SendMessageContext } from '@/onebot/api';
|
import { SendMessageContext } from '@/onebot/api';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
file: coerce.string(),
|
file: actionType.string(),
|
||||||
name: coerce.string(),
|
name: actionType.string(),
|
||||||
folder: coerce.string().optional(),
|
folder: actionType.string().optional(),
|
||||||
folder_id: coerce.string().optional(),//临时扩展
|
folder_id: actionType.string().optional(),//临时扩展
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -6,11 +6,11 @@ import { uriToLocalFile } from '@/common/file';
|
|||||||
import { SendMessageContext } from '@/onebot/api';
|
import { SendMessageContext } from '@/onebot/api';
|
||||||
import { ContextMode, createContext } from '@/onebot/action/msg/SendMsg';
|
import { ContextMode, createContext } from '@/onebot/action/msg/SendMsg';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
file: coerce.string(),
|
file: actionType.string(),
|
||||||
name: coerce.string(),
|
name: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,9 +2,9 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string(),
|
message_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
notice_id: coerce.string()
|
notice_id: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,11 +2,11 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
character: coerce.string(),
|
character: actionType.string(),
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
text: coerce.string(),
|
text: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -5,9 +5,9 @@ import { MessageUnique } from '@/common/message-unique';
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,9 +3,9 @@ import { OB11Construct } from '@/onebot/helper/data';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,10 +3,10 @@ import { OB11Construct } from '@/onebot/helper/data';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
no_cache: coerce.boolean().default(false),
|
no_cache: actionType.boolean().default(false),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,12 +3,12 @@ import { OB11Construct } from '@/onebot/helper/data';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
no_cache: coerce.boolean().default(false),
|
no_cache: actionType.boolean().default(false),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -4,11 +4,11 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { GroupMember } from '@/core';
|
import { GroupMember } from '@/core';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
no_cache: coerce.boolean().default(false)
|
no_cache: actionType.boolean().default(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,7 +2,7 @@ import { WebApiGroupNoticeFeed } from '@/core';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
interface GroupNotice {
|
interface GroupNotice {
|
||||||
sender_id: number;
|
sender_id: number;
|
||||||
publish_time: number;
|
publish_time: number;
|
||||||
@@ -18,7 +18,7 @@ interface GroupNotice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,9 +2,9 @@ import { ShutUpGroupMember } from '@/core';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,11 +2,11 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/core/packet/entities/aiChat';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
character: coerce.string(),
|
character: actionType.string(),
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
text: coerce.string(),
|
text: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,9 +2,9 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string(),
|
message_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,12 +2,12 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { NTGroupRequestOperateTypes } from '@/core/types';
|
import { NTGroupRequestOperateTypes } from '@/core/types';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
flag: coerce.string(),
|
flag: actionType.string(),
|
||||||
approve: coerce.boolean().default(true),
|
approve: actionType.boolean().default(true),
|
||||||
reason: coerce.string().nullable().default(' '),
|
reason: actionType.string().nullable().default(' '),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,12 +2,12 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { NTGroupMemberRole } from '@/core/types';
|
import { NTGroupMemberRole } from '@/core/types';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
enable: coerce.boolean().default(false),
|
enable: actionType.boolean().default(false),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
duration: coerce.number().default(0),
|
duration: actionType.number().default(0),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
card: coerce.string().optional(),
|
card: actionType.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
reject_add_request: coerce.boolean().optional(),
|
reject_add_request: actionType.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
is_dismiss: coerce.boolean().optional(),
|
is_dismiss: actionType.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
group_name: coerce.string(),
|
group_name: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string(),
|
group_id: actionType.string(),
|
||||||
enable: coerce.boolean().optional(),
|
enable: actionType.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,10 +2,10 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string(),
|
message_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,11 +3,11 @@ import { ChatType, Peer } from '@/core/types';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string(),
|
message_id: actionType.string(),
|
||||||
group_id: coerce.string().optional(),
|
group_id: actionType.string().optional(),
|
||||||
user_id: coerce.string().optional(),
|
user_id: actionType.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -5,11 +5,11 @@ import { MessageUnique } from '@/common/message-unique';
|
|||||||
import { RawMessage } from '@/core';
|
import { RawMessage } from '@/core';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
export type ReturnDataType = OB11Message
|
export type ReturnDataType = OB11Message
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string(),
|
message_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,11 +3,11 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string().optional(),
|
user_id: actionType.string().optional(),
|
||||||
group_id: coerce.string().optional(),
|
group_id: actionType.string().optional(),
|
||||||
message_id: coerce.string().optional(),
|
message_id: actionType.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type PlayloadType = z.infer<typeof SchemaData>;
|
type PlayloadType = z.infer<typeof SchemaData>;
|
||||||
|
@@ -2,12 +2,12 @@ import { ActionName } from '@/onebot/action/router';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
message_id: coerce.string(),
|
message_id: actionType.string(),
|
||||||
emoji_id: coerce.string(),
|
emoji_id: actionType.string(),
|
||||||
set: coerce.boolean().optional(),
|
set: actionType.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
group_id: coerce.string().optional(),
|
group_id: actionType.string().optional(),
|
||||||
user_id: coerce.string(),
|
user_id: actionType.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
interface Response {
|
interface Response {
|
||||||
cookies: string,
|
cookies: string,
|
||||||
@@ -9,7 +9,7 @@ interface Response {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
domain: coerce.string()
|
domain: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
user_id: coerce.string()
|
user_id: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
interface Response {
|
interface Response {
|
||||||
cookies: string,
|
cookies: string,
|
||||||
bkn: string
|
bkn: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
domain: coerce.string()
|
domain: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,10 +3,10 @@ import { OB11Construct } from '@/onebot/helper/data';
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
no_cache: coerce.boolean().optional(),
|
no_cache: actionType.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -3,10 +3,10 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
import { NetworkAdapterConfig } from '@/onebot/config/config';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
count: coerce.number().default(10),
|
count: actionType.number().default(10),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
times: coerce.number().default(1),
|
times: actionType.number().default(1),
|
||||||
user_id: coerce.string()
|
user_id: actionType.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
import { ActionName } from '@/onebot/action/router';
|
import { ActionName } from '@/onebot/action/router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
|
|
||||||
const SchemaData = z.object({
|
const SchemaData = z.object({
|
||||||
flag: coerce.string(),
|
flag: actionType.string(),
|
||||||
approve: coerce.boolean().default(true),
|
approve: actionType.boolean().default(true),
|
||||||
remark: coerce.string().nullable().optional()
|
remark: actionType.string().nullable().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = z.infer<typeof SchemaData>;
|
type Payload = z.infer<typeof SchemaData>;
|
||||||
|
@@ -1,72 +1,72 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '../../common/coerce';
|
import { actionType } from '../../common/coerce';
|
||||||
|
|
||||||
const HttpServerConfigSchema = z.object({
|
const HttpServerConfigSchema = z.object({
|
||||||
name: coerce.string().default('http-server'),
|
name: actionType.string().default('http-server'),
|
||||||
enable: coerce.boolean().default(false),
|
enable: actionType.boolean().default(false),
|
||||||
port: coerce.number().default(3000),
|
port: actionType.number().default(3000),
|
||||||
host: coerce.string().default('0.0.0.0'),
|
host: actionType.string().default('0.0.0.0'),
|
||||||
enableCors: coerce.boolean().default(true),
|
enableCors: actionType.boolean().default(true),
|
||||||
enableWebsocket: coerce.boolean().default(true),
|
enableWebsocket: actionType.boolean().default(true),
|
||||||
messagePostFormat: coerce.string().default('array'),
|
messagePostFormat: actionType.string().default('array'),
|
||||||
token: coerce.string().default(''),
|
token: actionType.string().default(''),
|
||||||
debug: coerce.boolean().default(false)
|
debug: actionType.boolean().default(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
const HttpSseServerConfigSchema = z.object({
|
const HttpSseServerConfigSchema = z.object({
|
||||||
name: coerce.string().default('http-sse-server'),
|
name: actionType.string().default('http-sse-server'),
|
||||||
enable: coerce.boolean().default(false),
|
enable: actionType.boolean().default(false),
|
||||||
port: coerce.number().default(3000),
|
port: actionType.number().default(3000),
|
||||||
host: coerce.string().default('0.0.0.0'),
|
host: actionType.string().default('0.0.0.0'),
|
||||||
enableCors: coerce.boolean().default(true),
|
enableCors: actionType.boolean().default(true),
|
||||||
enableWebsocket: coerce.boolean().default(true),
|
enableWebsocket: actionType.boolean().default(true),
|
||||||
messagePostFormat: coerce.string().default('array'),
|
messagePostFormat: actionType.string().default('array'),
|
||||||
token: coerce.string().default(''),
|
token: actionType.string().default(''),
|
||||||
debug: coerce.boolean().default(false),
|
debug: actionType.boolean().default(false),
|
||||||
reportSelfMessage: coerce.boolean().default(false)
|
reportSelfMessage: actionType.boolean().default(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
const HttpClientConfigSchema = z.object({
|
const HttpClientConfigSchema = z.object({
|
||||||
name: coerce.string().default('http-client'),
|
name: actionType.string().default('http-client'),
|
||||||
enable: coerce.boolean().default(false),
|
enable: actionType.boolean().default(false),
|
||||||
url: coerce.string().default('http://localhost:8080'),
|
url: actionType.string().default('http://localhost:8080'),
|
||||||
messagePostFormat: coerce.string().default('array'),
|
messagePostFormat: actionType.string().default('array'),
|
||||||
reportSelfMessage: coerce.boolean().default(false),
|
reportSelfMessage: actionType.boolean().default(false),
|
||||||
token: coerce.string().default(''),
|
token: actionType.string().default(''),
|
||||||
debug: coerce.boolean().default(false)
|
debug: actionType.boolean().default(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
const WebsocketServerConfigSchema = z.object({
|
const WebsocketServerConfigSchema = z.object({
|
||||||
name: coerce.string().default('websocket-server'),
|
name: actionType.string().default('websocket-server'),
|
||||||
enable: coerce.boolean().default(false),
|
enable: actionType.boolean().default(false),
|
||||||
host: coerce.string().default('0.0.0.0'),
|
host: actionType.string().default('0.0.0.0'),
|
||||||
port: coerce.number().default(3001),
|
port: actionType.number().default(3001),
|
||||||
messagePostFormat: coerce.string().default('array'),
|
messagePostFormat: actionType.string().default('array'),
|
||||||
reportSelfMessage: coerce.boolean().default(false),
|
reportSelfMessage: actionType.boolean().default(false),
|
||||||
token: coerce.string().default(''),
|
token: actionType.string().default(''),
|
||||||
enableForcePushEvent: coerce.boolean().default(true),
|
enableForcePushEvent: actionType.boolean().default(true),
|
||||||
debug: coerce.boolean().default(false),
|
debug: actionType.boolean().default(false),
|
||||||
heartInterval: coerce.number().default(30000)
|
heartInterval: actionType.number().default(30000)
|
||||||
});
|
});
|
||||||
|
|
||||||
const WebsocketClientConfigSchema = z.object({
|
const WebsocketClientConfigSchema = z.object({
|
||||||
name: coerce.string().default('websocket-client'),
|
name: actionType.string().default('websocket-client'),
|
||||||
enable: coerce.boolean().default(false),
|
enable: actionType.boolean().default(false),
|
||||||
url: coerce.string().default('ws://localhost:8082'),
|
url: actionType.string().default('ws://localhost:8082'),
|
||||||
messagePostFormat: coerce.string().default('array'),
|
messagePostFormat: actionType.string().default('array'),
|
||||||
reportSelfMessage: coerce.boolean().default(false),
|
reportSelfMessage: actionType.boolean().default(false),
|
||||||
reconnectInterval: coerce.number().default(5000),
|
reconnectInterval: actionType.number().default(5000),
|
||||||
token: coerce.string().default(''),
|
token: actionType.string().default(''),
|
||||||
debug: coerce.boolean().default(false),
|
debug: actionType.boolean().default(false),
|
||||||
heartInterval: coerce.number().default(30000)
|
heartInterval: actionType.number().default(30000)
|
||||||
});
|
});
|
||||||
|
|
||||||
const PluginConfigSchema = z.object({
|
const PluginConfigSchema = z.object({
|
||||||
name: coerce.string().default('plugin'),
|
name: actionType.string().default('plugin'),
|
||||||
enable: coerce.boolean().default(false),
|
enable: actionType.boolean().default(false),
|
||||||
messagePostFormat: coerce.string().default('array'),
|
messagePostFormat: actionType.string().default('array'),
|
||||||
reportSelfMessage: coerce.boolean().default(false),
|
reportSelfMessage: actionType.boolean().default(false),
|
||||||
debug: coerce.boolean().default(false),
|
debug: actionType.boolean().default(false),
|
||||||
});
|
});
|
||||||
|
|
||||||
const NetworkConfigSchema = z.object({
|
const NetworkConfigSchema = z.object({
|
||||||
@@ -80,9 +80,9 @@ const NetworkConfigSchema = z.object({
|
|||||||
|
|
||||||
export const OneBotConfigSchema = z.object({
|
export const OneBotConfigSchema = z.object({
|
||||||
network: NetworkConfigSchema,
|
network: NetworkConfigSchema,
|
||||||
musicSignUrl: coerce.string().default(''),
|
musicSignUrl: actionType.string().default(''),
|
||||||
enableLocalFile2Url: coerce.boolean().default(false),
|
enableLocalFile2Url: actionType.boolean().default(false),
|
||||||
parseMultMsg: coerce.boolean().default(false)
|
parseMultMsg: actionType.boolean().default(false)
|
||||||
});
|
});
|
||||||
|
|
||||||
export type OneBotConfig = z.infer<typeof OneBotConfigSchema>;
|
export type OneBotConfig = z.infer<typeof OneBotConfigSchema>;
|
||||||
|
@@ -4,14 +4,14 @@ import { resolve } from 'node:path';
|
|||||||
import { deepMerge } from '../utils/object';
|
import { deepMerge } from '../utils/object';
|
||||||
import { themeType } from '../types/theme';
|
import { themeType } from '../types/theme';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
// 定义配置的类型
|
// 定义配置的类型
|
||||||
const WebUiConfigSchema = z.object({
|
const WebUiConfigSchema = z.object({
|
||||||
host: coerce.string().default('0.0.0.0'),
|
host: actionType.string().default('0.0.0.0'),
|
||||||
port: coerce.number().default(6099),
|
port: actionType.number().default(6099),
|
||||||
token: coerce.string().default('napcat'),
|
token: actionType.string().default('napcat'),
|
||||||
loginRate: coerce.number().default(10),
|
loginRate: actionType.number().default(10),
|
||||||
autoLoginAccount: coerce.string().default(''),
|
autoLoginAccount: actionType.string().default(''),
|
||||||
theme: themeType,
|
theme: themeType,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { coerce } from '@/common/coerce';
|
import { actionType } from '@/common/coerce';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
export const themeType = z.object(
|
export const themeType = z.object(
|
||||||
{
|
{
|
||||||
dark: z.record(coerce.string(), coerce.string()),
|
dark: z.record(actionType.string(), actionType.string()),
|
||||||
light: z.record(coerce.string(), coerce.string()),
|
light: z.record(actionType.string(), actionType.string()),
|
||||||
}
|
}
|
||||||
).default({
|
).default({
|
||||||
dark: {
|
dark: {
|
||||||
|
Reference in New Issue
Block a user