chore:action

This commit is contained in:
手瓜一十雪
2024-08-09 16:15:17 +08:00
parent 013df1dbdd
commit 67d92c61f7
19 changed files with 48 additions and 80 deletions

View File

@@ -1,10 +1,8 @@
import BaseAction from '../BaseAction';
import { getGroup } from '@/core/data';
import { ActionName } from '../types';
import { SendMsgElementConstructor } from '@/core/entities/constructor';
import { ChatType, SendFileElement } from '@/core/entities';
import fs from 'fs';
import { SendMsg, sendMsg } from '@/onebot11/action/msg/SendMsg';
import { sendMsg } from '@/onebot/action/msg/SendMsg';
import { uri2local } from '@/common/utils/file';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
const SchemaData = {
@@ -25,10 +23,6 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
actionName = ActionName.GoCQHTTP_UploadGroupFile;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> {
const group = await getGroup(payload.group_id.toString());
if (!group) {
throw new Error(`群组${payload.group_id}不存在`);
}
let file = payload.file;
if (fs.existsSync(file)) {
file = `file://${file}`;