mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: get file way 01 get by msg & seq id
This commit is contained in:
parent
3f24461612
commit
f1643ac549
@ -259,7 +259,7 @@ export class NTQQFileApi {
|
||||
return sourcePath;
|
||||
}
|
||||
}
|
||||
await this.core.eventWrapper.callNormalEventV2(
|
||||
const [, completeRetData] = await this.core.eventWrapper.callNormalEventV2(
|
||||
'NodeIKernelMsgService/downloadRichMedia',
|
||||
'NodeIKernelMsgListener/onRichMediaDownloadComplete',
|
||||
[{
|
||||
@ -279,24 +279,7 @@ export class NTQQFileApi {
|
||||
1,
|
||||
timeout,
|
||||
);
|
||||
const mixElement = (await this.core.apis.MsgApi.getMsgsByMsgId({
|
||||
guildId: '',
|
||||
chatType: chatType,
|
||||
peerUid: peerUid,
|
||||
}, [msgId])).msgList
|
||||
.find((msg) => msg.msgId === msgId)
|
||||
?.elements.find((e) => e.elementId === elementId);
|
||||
const mixElementInner = mixElement?.videoElement
|
||||
?? mixElement?.fileElement
|
||||
?? mixElement?.pttElement
|
||||
?? mixElement?.picElement;
|
||||
let realPath = mixElementInner?.filePath;
|
||||
if (!realPath) {
|
||||
const picThumbPath: Map<number, string> = (mixElementInner as any)?.picThumbPath;
|
||||
const picThumbPathList = Array.from(picThumbPath.values());
|
||||
if (picThumbPathList.length > 0) realPath = picThumbPathList[0];
|
||||
}
|
||||
return realPath;
|
||||
return completeRetData.filePath;
|
||||
}
|
||||
|
||||
async getImageSize(filePath: string): Promise<ISizeCalculationResult> {
|
||||
|
@ -106,12 +106,13 @@ export class OneBotMsgApi {
|
||||
peerUid: msg.peerUid,
|
||||
guildId: '',
|
||||
};
|
||||
const encodedFileId = FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId);
|
||||
return {
|
||||
type: OB11MessageDataType.image,
|
||||
data: {
|
||||
file: element.fileName,
|
||||
file: encodedFileId,
|
||||
sub_type: element.picSubType,
|
||||
file_id: FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId),
|
||||
file_id: encodedFileId,
|
||||
url: await this.core.apis.FileApi.getImageUrl(element),
|
||||
file_size: element.fileSize,
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user