From 7d709f44a8d48de28d53ec8c0b87a9eb9f2c0de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Thu, 26 Sep 2024 15:37:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot/api/msg.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index 73cffa13..fbf95550 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -235,18 +235,28 @@ export class OneBotMsgApi { let videoUrlWrappers: Awaited> | undefined; if (msg.peerUin === '284840486' || msg.peerUin === '1094950020') { - //TODO: 合并消息内部 应该进行特殊处理 可能需要重写peer 待测试与研究 Mlikiowa Tagged - } - try { - videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({ - chatType: msg.chatType, - peerUid: msg.peerUid, - guildId: '0', - }, msg.msgId, elementWrapper.elementId); - } catch (error) { - this.core.context.logger.logWarn('获取视频 URL 失败'); + try { + videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({ + chatType: msg.chatType, + peerUid: msg.peerUid, + guildId: '0', + }, msg.parentMsgIdList[0] ?? msg.msgId, elementWrapper.elementId); + } catch (error) { + this.core.context.logger.logWarn('合并获取视频 URL 失败'); + } + } else { + try { + videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({ + chatType: msg.chatType, + peerUid: msg.peerUid, + guildId: '0', + }, msg.msgId, elementWrapper.elementId); + } catch (error) { + this.core.context.logger.logWarn('获取视频 URL 失败'); + } } + //读取在线URL let videoDownUrl: string | undefined;