fix: get file by msgId and elemId

This commit is contained in:
Wesley F. Young 2024-08-31 10:34:19 +08:00
parent f5e7288fe5
commit 92f8eaaac9
2 changed files with 3 additions and 2 deletions

View File

@ -31,8 +31,8 @@ export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
const NTQQMsgApi = this.core.apis.MsgApi;
const NTQQFileApi = this.core.apis.FileApi;
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file);
//接收消息标记模式
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file);
if (contextMsgFile) {
const { peer, msgId, elementId } = contextMsgFile;
const downloadPath = await NTQQFileApi.downloadMedia(msgId, peer.chatType, peer.peerUid, elementId, '', '');
@ -59,6 +59,7 @@ export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
}
return res;
}
//群文件模式
const contextModelIdFile = FileNapCatOneBotUUID.decodeModelId(payload.file);
if (contextModelIdFile) {

View File

@ -80,7 +80,7 @@ export class OneBotGroupApi {
id: FileNapCatOneBotUUID.encode({
chatType: ChatType.KCHATTYPEGROUP,
peerUid: msg.peerUid,
}, msg.msgSeq, element.elementId),
}, msg.msgId, element.elementId),
name: element.fileElement.fileName,
size: parseInt(element.fileElement.fileSize),
busid: element.fileElement.fileBizId || 0,