mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-21 14:20:06 +08:00
* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
|
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
|
|
const SchemaData = Type.Object({
|
|
group_id: Type.Union([Type.Number(), Type.String()]),
|
|
file_id: Type.String(),
|
|
});
|
|
|
|
type Payload = Static<typeof SchemaData>;
|
|
|
|
interface GetGroupFileUrlResponse {
|
|
url?: string;
|
|
}
|
|
|
|
export class GetGroupFileUrl extends GetPacketStatusDepends<Payload, GetGroupFileUrlResponse> {
|
|
override actionName = ActionName.GOCQHTTP_GetGroupFileUrl;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle (payload: Payload) {
|
|
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file_id) || FileNapCatOneBotUUID.decodeModelId(payload.file_id);
|
|
if (contextMsgFile?.fileUUID) {
|
|
return {
|
|
url: await this.core.apis.PacketApi.pkt.operation.GetGroupFileUrl(+payload.group_id, contextMsgFile.fileUUID),
|
|
};
|
|
}
|
|
throw new Error('real fileUUID not found!');
|
|
}
|
|
}
|