feat: 一些小工具

This commit is contained in:
ikechan8370 2023-06-26 14:50:43 +08:00
parent c99af43571
commit ca28b00679
3 changed files with 113 additions and 9 deletions

View file

@ -40,7 +40,6 @@ import ChatGLMClient from '../utils/chatglm.js'
import { convertFaces } from '../utils/face.js'
import uploadRecord from '../utils/uploadRecord.js'
import { SlackClaudeClient } from '../utils/slack/slackClient.js'
import { ChatgptManagement } from './management.js'
import { getPromptByName } from '../utils/prompts.js'
import BingDrawClient from '../utils/BingDraw.js'
import XinghuoClient from '../utils/xinghuo/xinghuo.js'
@ -48,8 +47,6 @@ import { JinyanTool } from '../utils/tools/JinyanTool.js'
import { SendMusicTool } from '../utils/tools/SendMusicTool.js'
import { SendVideoTool } from '../utils/tools/SendBilibiliTool.js'
import { KickOutTool } from '../utils/tools/KickOutTool.js'
import { SendAvatarTool } from '../utils/tools/SendAvatarTool.js'
import { SendDiceTool } from '../utils/tools/SendDiceTool.js'
import { EditCardTool } from '../utils/tools/EditCardTool.js'
import { SearchVideoTool } from '../utils/tools/SearchBilibiliTool.js'
import { SearchMusicTool } from '../utils/tools/SearchMusicTool.js'
@ -64,7 +61,9 @@ import { ImageCaptionTool } from '../utils/tools/ImageCaptionTool.js'
import { TTSTool } from '../utils/tools/TTSTool.js'
import { ProcessPictureTool } from '../utils/tools/ProcessPictureTool.js'
import { APTool } from '../utils/tools/APTool.js'
import {QueryGenshinTool} from "../utils/tools/QueryGenshinTool.js";
import { QueryGenshinTool } from '../utils/tools/QueryGenshinTool.js'
import { HandleMessageMsgTool } from '../utils/tools/HandleMessageMsgTool.js'
import {QueryUserinfoTool} from "../utils/tools/QueryUserinfoTool.js";
try {
await import('emoji-strip')
} catch (err) {
@ -1979,24 +1978,40 @@ export class chatgpt extends plugin {
new TTSTool(),
new ProcessPictureTool(),
new APTool(),
new QueryGenshinTool()
new QueryGenshinTool(),
new HandleMessageMsgTool(),
new QueryUserinfoTool()
]
// todo 3.0再重构tool的插拔和管理
let tools = [
// new SendAvatarTool(),
// new SendDiceTool(),
new EditCardTool(),
// new EditCardTool(),
new QueryStarRailTool(),
new QueryGenshinTool(),
new WebsiteTool(),
new JinyanTool(),
new KickOutTool(),
// new JinyanTool(),
// new KickOutTool(),
new WeatherTool(),
new SendPictureTool(),
new TTSTool(),
new APTool(),
serpTool
// new HandleMessageMsgTool(),
serpTool,
new QueryUserinfoTool()
]
if (e.isGroup) {
let botInfo = await Bot.getGroupMemberInfo(e.group_id, Bot.uin, true)
if (botInfo.role !== 'member') {
// 管理员才给这些工具
tools.push(...[new EditCardTool(), new JinyanTool(), new KickOutTool(), new HandleMessageMsgTool()])
// 用于撤回和加精的id
option.systemMessage += `\nthis last message id is ${e.message_id}`
if (e.source?.message_id) {
option.systemMessage += `\nthis last message is replying to ${e.source.message_id}: ${(await e.group.getChatHistory(e.source.seq, 1)).pop()?.raw_message}`
}
}
}
let img = []
if (e.source) {
// 优先从回复找图