mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 22:07:10 +00:00
fix: 尝试修复onebot无法获取群聊记录及图片tools发图异常
1.类比shamrock,onebot使用e.group.getChatHistory(0, num, false)可以直接取到记录历史记录 2.我这边napcat的onebot得到的e.bot.getGroupList()是数组这。不同协议差别这么大吗。。先这样能发送了
This commit is contained in:
parent
4900f40502
commit
aaaee383a8
2 changed files with 43 additions and 42 deletions
|
|
@ -2,9 +2,9 @@ import { Config } from './config.js'
|
|||
import { newFetch } from './proxy.js'
|
||||
|
||||
export async function getChatHistoryGroup (e, num) {
|
||||
// if (e.adapter === 'shamrock') {
|
||||
// return await e.group.getChatHistory(0, num, false)
|
||||
// } else {
|
||||
if (e.adapter_name && e.adapter_name === 'OneBotv11') {
|
||||
return await e.group.getChatHistory(0, num, false)
|
||||
} else {
|
||||
let latestChats = await e.group.getChatHistory(e.seq || e.message_id, 1)
|
||||
if (latestChats.length > 0) {
|
||||
let latestChat = latestChats[0]
|
||||
|
|
@ -49,7 +49,7 @@ export async function getChatHistoryGroup (e, num) {
|
|||
return chats
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ export class SendPictureTool extends AbstractTool {
|
|||
}
|
||||
let errs = []
|
||||
try {
|
||||
if (groupList.get(target)) {
|
||||
if ((typeof groupList.get === 'function' && groupList.get(target)) ||
|
||||
(Array.isArray(groupList) && groupList.includes(target))) {
|
||||
let group = await e.bot.pickGroup(target)
|
||||
for (let pic of pictures) {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue