chore: run a full eslint

This commit is contained in:
Wesley F. Young
2024-08-10 19:58:31 +08:00
parent 5a5257294b
commit 87c3b24488
198 changed files with 8187 additions and 7744 deletions

View File

@@ -6,6 +6,7 @@ import { sendMsg } from '@/onebot/action/msg/SendMsg';
import { uri2local } from '@/common/utils/file';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { SendMsgElementConstructor } from '@/onebot/helper/msg';
const SchemaData = {
type: 'object',
properties: {
@@ -13,9 +14,9 @@ const SchemaData = {
file: { type: 'string' },
name: { type: 'string' },
folder: { type: 'string' },
folder_id: { type: 'string' }//临时扩展
folder_id: { type: 'string' },//临时扩展
},
required: ['group_id', 'file', 'name']
required: ['group_id', 'file', 'name'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -23,6 +24,7 @@ type Payload = FromSchema<typeof SchemaData>;
export default class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
actionName = ActionName.GoCQHTTP_UploadGroupFile;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> {
let file = payload.file;
if (fs.existsSync(file)) {
@@ -33,7 +35,10 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
throw new Error(downloadResult.errMsg);
}
const sendFileEle: SendFileElement = await SendMsgElementConstructor.file(this.CoreContext, downloadResult.path, payload.name, payload.folder_id);
await sendMsg(this.CoreContext, { chatType: ChatType.group, peerUid: payload.group_id.toString() }, [sendFileEle], [], true);
await sendMsg(this.CoreContext, {
chatType: ChatType.group,
peerUid: payload.group_id.toString(),
}, [sendFileEle], [], true);
return null;
}
}