fix: getfile

This commit is contained in:
手瓜一十雪
2024-08-29 20:14:20 +08:00
parent a598266a6e
commit a2fa085d5f
4 changed files with 12 additions and 17 deletions

View File

@@ -33,20 +33,16 @@ export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
const NTQQFileApi = this.core.apis.FileApi;
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file);
//接收消息标记模式
if (contextMsgFile) {
const { peer, msgId, elementId } = contextMsgFile;
const downloadPath = await NTQQFileApi.downloadMedia(msgId, peer.chatType, peer.peerUid, elementId, '', '');
const mixElement = (await NTQQMsgApi.getMsgsByMsgId(peer, [msgId]))?.msgList
.find(msg => msg.msgId === msgId)?.elements.find(e => e.elementId === elementId);
const mixElementInner = mixElement?.videoElement ?? mixElement?.fileElement ?? mixElement?.pttElement ?? mixElement?.picElement;
if (!mixElementInner) throw new Error('element not found');
const fileSize = mixElementInner.fileSize?.toString() || '';
const fileName = mixElementInner.fileName || '';
const fileSize = mixElementInner.fileSize?.toString() ?? '';
const fileName = mixElementInner.fileName ?? '';
const res: GetFileResponse = {
file: downloadPath,