chore: DownloadRichMedia

This commit is contained in:
手瓜一十雪
2024-08-12 13:29:59 +08:00
parent b810040145
commit 8d1241808a

View File

@@ -141,16 +141,26 @@ export class NTQQFileApi {
filePath: thumbPath, filePath: thumbPath,
}, },
); );
let filePath = data[1].filePath; let msg = await this.core.apis.MsgApi.getMsgsByMsgId({
if (filePath.startsWith('\\')) { guildId: '',
// log('filePath start with \\'); chatType: chatType,
// Mlikiowa V2.0.0 Refactor Todo peerUid: peerUid,
//const downloadPath = sessionConfig.defaultFileDownloadPath; }, [msgId]);
//logDebug('downloadPath', downloadPath); if (msg.msgList.length === 0) {
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! return data[1].filePath;
filePath = path.join('', filePath);
// 下载路径是下载文件夹的相对路径
} }
//获取原始消息
let FileElements = msg?.msgList[0]?.elements?.find(e => e.elementId === elementId);
if (!FileElements) {
//失败则就乱来 Todo
return data[1].filePath;
}
//从原始消息获取文件路径
let filePath =
FileElements?.fileElement?.filePath ||
FileElements?.pttElement?.filePath ||
FileElements?.videoElement?.filePath ||
FileElements?.picElement?.sourcePath;
return filePath; return filePath;
} }