mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 00:10:27 +00:00
Replaced Type.Union([Type.Number(), Type.String()]) with Type.String for group_id, user_id, and similar fields across all action payload schemas to standardize input types. Also made minor improvements to error handling, return types, and removed unused imports for better code clarity and consistency.
26 lines
1021 B
TypeScript
26 lines
1021 B
TypeScript
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
|
|
const PayloadSchema = Type.Object({
|
|
group_id: Type.String({ description: '群号' }),
|
|
folder_id: Type.Optional(Type.String({ description: '文件夹ID' })),
|
|
folder: Type.Optional(Type.String({ description: '文件夹ID' })),
|
|
});
|
|
|
|
type PayloadType = Static<typeof PayloadSchema>;
|
|
|
|
const ReturnSchema = Type.Any({ description: '删除结果' });
|
|
|
|
type ReturnType = Static<typeof ReturnSchema>;
|
|
|
|
export class DeleteGroupFileFolder extends OneBotAction<PayloadType, ReturnType> {
|
|
override actionName = ActionName.GoCQHTTP_DeleteGroupFileFolder;
|
|
override payloadSchema = PayloadSchema;
|
|
override returnSchema = ReturnSchema;
|
|
async _handle (payload: PayloadType) {
|
|
return (await this.core.apis.GroupApi.delGroupFileFolder(
|
|
payload.group_id.toString(), payload.folder ?? payload.folder_id ?? '')).groupFileCommonResult;
|
|
}
|
|
}
|