mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
Merge branch 'pr-774' into v2
兼容napcat
This commit is contained in:
commit
abf6fa6ac2
3 changed files with 52 additions and 42 deletions
|
|
@ -2,9 +2,9 @@ import { Config } from './config.js'
|
||||||
import { newFetch } from './proxy.js'
|
import { newFetch } from './proxy.js'
|
||||||
|
|
||||||
export async function getChatHistoryGroup (e, num) {
|
export async function getChatHistoryGroup (e, num) {
|
||||||
// if (e.adapter === 'shamrock') {
|
if (e.adapter_name && e.adapter_name === 'OneBotv11') {
|
||||||
// return await e.group.getChatHistory(0, num, false)
|
return await e.group.getChatHistory(0, num, false)
|
||||||
// } else {
|
} else {
|
||||||
let latestChats = await e.group.getChatHistory(e.seq || e.message_id, 1)
|
let latestChats = await e.group.getChatHistory(e.seq || e.message_id, 1)
|
||||||
if (latestChats.length > 0) {
|
if (latestChats.length > 0) {
|
||||||
let latestChat = latestChats[0]
|
let latestChat = latestChats[0]
|
||||||
|
|
@ -49,7 +49,7 @@ export async function getChatHistoryGroup (e, num) {
|
||||||
return chats
|
return chats
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -734,6 +734,15 @@ export async function getImg (e) {
|
||||||
e.img = i
|
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
|
return e.img
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ export class SendPictureTool extends AbstractTool {
|
||||||
}
|
}
|
||||||
let errs = []
|
let errs = []
|
||||||
try {
|
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)
|
let group = await e.bot.pickGroup(target)
|
||||||
for (let pic of pictures) {
|
for (let pic of pictures) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue