mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 06:31:13 +00:00
* feat: implement QQ online file transfer and flash transfer support * fix: change OnlineFile OB11Message data * fix: add fileSize and isDir to OB11MessageOnlineFile * fix: resolve typescript strict mode errors
25 lines
880 B
TypeScript
25 lines
880 B
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||
import { ActionName } from '@/napcat-onebot/action/router';
|
||
import { Static, Type } from '@sinclair/typebox';
|
||
|
||
// 不全部使用json因为:一个文件解析Form-data会变字符串!!! 但是api文档就写List
|
||
const SchemaData = Type.Object({
|
||
files: Type.Union([
|
||
Type.Array(Type.String()),
|
||
Type.String(),
|
||
]),
|
||
});
|
||
type Payload = Static<typeof SchemaData>;
|
||
|
||
export class CreateFlashTask extends OneBotAction<Payload, unknown> {
|
||
override actionName = ActionName.CreateFlashTask;
|
||
override payloadSchema = SchemaData;
|
||
|
||
async _handle (payload: Payload) {
|
||
// todo fileset的名字和缩略图还没实现!!
|
||
const fileList = Array.isArray(payload.files) ? payload.files : [payload.files];
|
||
|
||
return await this.core.apis.FlashApi.createFlashTransferUploadTask(fileList);
|
||
}
|
||
}
|