From 2027da1db5832e7712c570306b787e3eb802be65 Mon Sep 17 00:00:00 2001 From: Alen Date: Wed, 28 Aug 2024 23:24:44 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot/api/msg.ts | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index 3621abee..3b4fc0d5 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -208,27 +208,20 @@ export class OneBotMsgApi { return null; } - // 合并转发直接返回 + const createReplyData = (msgId: string): OB11MessageData => ({ + type: OB11MessageDataType.reply, + data: { + id: MessageUnique.createUniqueMsgId(peer, msgId).toString(), + }, + }); + if (records.peerUin === '284840486') { - return { - type: OB11MessageDataType.reply, - data: { - id: MessageUnique.createUniqueMsgId({ - peerUid: msg.peerUid, - guildId: '', - chatType: msg.chatType, - }, records.msgId).toString(), - }, - }; + return createReplyData(records.msgId); } let replyMsg: RawMessage | undefined; // Attempt 1 - replyMsg = (await NTQQMsgApi.getMsgsBySeqAndCount({ - peerUid: msg.peerUid, - guildId: '', - chatType: msg.chatType, - }, element.replayMsgSeq, 1, true, true)) + replyMsg = (await NTQQMsgApi.getMsgsBySeqAndCount(peer,element.replayMsgSeq, 1, true, true)) .msgList .find(msg => msg.msgRandom === records.msgRandom); @@ -248,16 +241,7 @@ export class OneBotMsgApi { } } - return { - type: OB11MessageDataType.reply, - data: { - id: MessageUnique.createUniqueMsgId({ - peerUid: msg.peerUid, - guildId: '', - chatType: msg.chatType, - }, replyMsg.msgId).toString(), - }, - }; + return createReplyData(replyMsg.msgId); }, videoElement: async (element, msg, elementWrapper) => {