feat: add a tool

This commit is contained in:
ikechan8370 2023-06-25 23:18:54 +08:00
parent 87182f1a1f
commit ced2b4eeb6
2 changed files with 41 additions and 0 deletions

View file

@ -64,6 +64,7 @@ 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";
try {
await import('emoji-strip')
} catch (err) {
@ -1985,6 +1986,7 @@ export class chatgpt extends plugin {
// new SendDiceTool(),
new EditCardTool(),
new QueryStarRailTool(),
new QueryGenshinTool(),
new WebsiteTool(),
new JinyanTool(),
new KickOutTool(),

View file

@ -0,0 +1,39 @@
import { AbstractTool } from './AbstractTool.js'
export class QueryGenshinTool extends AbstractTool {
name = 'queryGenshin'
parameters = {
properties: {
qq: {
type: 'string',
description: '要查询的用户的qq号将使用该qq号绑定的uid进行查询'
},
uid: {
type: 'string',
description: '游戏的uid如果用户提供了则传入并优先使用'
}
},
required: ['qq', 'groupId']
}
func = async function (opts, e) {
let { qq, uid } = opts
if (e.at === Bot.uin) {
e.at = null
}
e.atBot = false
try {
let ProfileList = (await import('../../../miao-plugin/apps/profile/ProfileList.js')).default
e.msg = '#面板' + uid
e.user_id = qq
e.isSr = false
await ProfileList.render(e)
return 'the player panel of genshin impact has been sent to group'
} catch (err) {
return `failed to query, error: ${err.toString()}`
}
}
description = 'Useful when you want to query player information of Genshin Impact(原神). '
}