refactor: msgId stage-2

This commit is contained in:
手瓜一十雪 committed 2024-07-22 11:34:18 +08:00
1 parent a8554878ac
commit ee6925edf9
9 files changed
+22 -31

No files matched your search

@@ -17,6 +17,7 @@ import { uri2local } from '@/common/utils/file';
import { ob11Config } from '@/onebot11/config';
import { RequestUtil } from '@/common/utils/request';
import fs from 'node:fs';
import { MessageUnique } from '@/common/utils/MessageUnique';
export type MessageContext = {
group?: Group,
@@ -36,10 +37,10 @@ async function handleOb11FileLikeMessage(
} else if (cache.url) {
uri = cache.url;
} else {
const fileMsg = await dbUtil.getMsgByLongId(cache.msgId);
if (fileMsg) {
const fileMsgPeer = MessageUnique.getPeerByMsgId(cache.msgId);
if (fileMsgPeer) {
cache.path = await NTQQFileApi.downloadMedia(
fileMsg.msgId, fileMsg.chatType, fileMsg.peerUid,
fileMsgPeer.MsgId, fileMsgPeer.Peer.chatType, fileMsgPeer.Peer.peerUid,
cache.elementId, '', ''
);
uri = 'file://' + cache.path;