fix: 跟进shamrock和lain的更新

This commit is contained in:
ikechan8370 2023-11-12 13:50:02 +08:00 committed by GitHub
parent 56a893734c
commit c99019cd91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 []
}