mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 15:11:15 +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
27 lines
934 B
TypeScript
27 lines
934 B
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
import { ChatType } from 'napcat-core/types';
|
|
|
|
const SchemaData = Type.Object({
|
|
user_id: Type.Union([Type.Number(), Type.String()]),
|
|
msg_id: Type.String(),
|
|
element_id: Type.String(),
|
|
});
|
|
|
|
type Payload = Static<typeof SchemaData>;
|
|
|
|
export class RefuseOnlineFile extends OneBotAction<Payload, unknown> {
|
|
override actionName = ActionName.RefuseOnlineFile;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle (payload: Payload) {
|
|
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
|
if (!uid) throw new Error('User not found');
|
|
|
|
const peer = { chatType: ChatType.KCHATTYPEC2C, peerUid: uid };
|
|
|
|
return await this.core.apis.OnlineApi.refuseOnlineFileMsg(peer, payload.msg_id, payload.element_id);
|
|
}
|
|
}
|