Merge branch 'pr-774' into v2

兼容napcat
This commit is contained in:
Chenyuxin221 2025-04-01 22:34:18 +08:00
commit abf6fa6ac2
3 changed files with 52 additions and 42 deletions

View file

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

View file

@ -734,6 +734,15 @@ export async function getImg (e) {
e.img = i
}
}
if (e.reply_id) {
let reply = (await e.getReply(e.reply_id)).message;
for (const val of reply) {
if (val.type === "image") {
e.img = [val.url];
break;
}
}
}
return e.img
}

View file

@ -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 {