From 49ba276f5dc128a427bef7baecf4d1c87d3b3ea1 Mon Sep 17 00:00:00 2001 From: linyuchen Date: Fri, 15 Mar 2024 11:41:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B6=E5=88=B0=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=B2=A1=E6=9C=89=E5=88=A0=E5=B9=B2=E5=87=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ntqqapi/hook.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ntqqapi/hook.ts b/src/ntqqapi/hook.ts index 529bd02..c50f6d7 100644 --- a/src/ntqqapi/hook.ts +++ b/src/ntqqapi/hook.ts @@ -220,24 +220,23 @@ registerReceiveHook<{ // 新消息 registerReceiveHook<{ msgList: Array }>(ReceiveCmd.NEW_MSG, (payload) => { const {autoDeleteFile} = getConfigUtil().getConfig(); + if (!autoDeleteFile) { + return + } for (const message of payload.msgList) { // log("收到新消息,push到历史记录", message.msgId) // dbUtil.addMsg(message).then() // 清理文件 - if (!autoDeleteFile) { - continue - } + for (const msgElement of message.elements) { - if (msgElement.videoElement) { - log("收到视频消息", msgElement.videoElement) - log("視頻缩略图", msgElement.videoElement.thumbPath.get(0)); - } setTimeout(() => { const picPath = msgElement.picElement?.sourcePath + const picThumbPath = [...msgElement.picElement?.thumbPath.values()] const pttPath = msgElement.pttElement?.filePath const filePath = msgElement.fileElement?.filePath const videoPath = msgElement.videoElement?.filePath - const pathList = [picPath, pttPath, filePath, videoPath] + const videoThumbPath: string[] = [...msgElement.videoElement?.thumbPath.values()] + const pathList = [picPath, ...picThumbPath, pttPath, filePath, videoPath, ...videoThumbPath] if (msgElement.picElement) { pathList.push(...Object.values(msgElement.picElement.thumbPath)) }