From c99019cd91f5993ad4de8edfd58dd3b9e668fcf2 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Sun, 12 Nov 2023 13:50:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B7=9F=E8=BF=9Bshamrock=E5=92=8Clain?= =?UTF-8?q?=E7=9A=84=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/chat.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/utils/chat.js b/utils/chat.js index 31102dd..8c27bad 100644 --- a/utils/chat.js +++ b/utils/chat.js @@ -1,16 +1,17 @@ export async function getChatHistoryGroup (e, num) { - if (e.adapter === 'shamrock') { - return await e.group.getChatHistory(0, num, false) - } else { + //if (e.adapter === 'shamrock') { + // return await e.group.getChatHistory(0, num, false) + //} else { let latestChats = await e.group.getChatHistory(0, 1) if (latestChats.length > 0) { let latestChat = latestChats[0] if (latestChat) { - let seq = latestChat.seq + let seq = latestChat.seq || latestChat.message_id let chats = [] while (chats.length < num) { let chatHistory = await e.group.getChatHistory(seq, 20) chats.push(...chatHistory) + seq = chatHistory[0].seq || chatHistory[0].message_id } chats = chats.slice(0, num) try { @@ -28,6 +29,6 @@ export async function getChatHistoryGroup (e, num) { return chats } } - } + // } return [] }