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,
},
);
let filePath = data[1].filePath;
if (filePath.startsWith('\\')) {
// log('filePath start with \\');
// Mlikiowa V2.0.0 Refactor Todo
//const downloadPath = sessionConfig.defaultFileDownloadPath;
//logDebug('downloadPath', downloadPath);
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
filePath = path.join('', filePath);
// 下载路径是下载文件夹的相对路径
let msg = await this.core.apis.MsgApi.getMsgsByMsgId({
guildId: '',
chatType: chatType,
peerUid: peerUid,
}, [msgId]);
if (msg.msgList.length === 0) {
return data[1].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;
}