mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
feat: 智能模式,添加群管、试图、联网搜索、发图、发音乐和视频等功能 (#488)
* fix: 2.7 dev start * feat: 初步支持function call(WIP) * fix: syntax error * fix: syntax error * feat: 群聊上下文 * fix: 暂时阉割掉全员禁言功能 * fix: 修改禁言时间范围 * fix: 修复一些功能易用性 * fix: 只有管理员和群主才能用jinyan和kickout * fix: 加回来禁言和踢出 * fix: 修复管理员权限判断问题(可能吧) * fix: 试图优化逻辑 * fix: fuck openai documents * fix: 删掉认主不然一直禁言我烦死了 * fix: 哔哩哔哩封面损坏问题 * fix: 加个天气小工具 * fix: 天气不存在城市 * fix: website工具用浏览器 * feat: serp tool * feat: 增加一个google搜索源 * fix: 加一句描述 * feat: 增加搜索来源选项 * feat: 搜图和发图 * fix: groupId format error * fix: add a image caption tool * fix: 修改一些提示。tool太多机器人开始混乱了 * fix: 一些极端的措施 * fix: 增加一些提示和一个暂时的公共接口 * fix: 收拾一下 * fix: 修改命令正则 * fix: 修改一些提示 * fix: move send avatar into send picture tool * fix: 修复解除禁言的bug
This commit is contained in:
parent
2c5b084b04
commit
b7427e74c4
42 changed files with 18987 additions and 58 deletions
76
utils/tools/QueryStarRailTool.js
Normal file
76
utils/tools/QueryStarRailTool.js
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import { AbstractTool } from './AbstractTool.js'
|
||||
|
||||
export class QueryStarRailTool extends AbstractTool {
|
||||
name = 'queryStarRail'
|
||||
|
||||
parameters = {
|
||||
properties: {
|
||||
qq: {
|
||||
type: 'string',
|
||||
description: '要查询的用户的qq号,将使用该qq号绑定的uid进行查询'
|
||||
},
|
||||
groupId: {
|
||||
type: 'string',
|
||||
description: '群号'
|
||||
},
|
||||
uid: {
|
||||
type: 'string',
|
||||
description: '游戏的uid,如果用户提供了则传入并优先使用'
|
||||
}
|
||||
},
|
||||
required: ['qq', 'groupId']
|
||||
}
|
||||
|
||||
func = async function (opts) {
|
||||
let { qq, groupId, uid } = opts
|
||||
if (!uid) {
|
||||
try {
|
||||
let { Panel } = await import('../../../StarRail-plugin/apps/panel.js')
|
||||
uid = await redis.get(`STAR_RAILWAY:UID:${qq}`)
|
||||
if (!uid) {
|
||||
return '用户没有绑定uid,无法查询。可以让用户主动提供uid进行查询'
|
||||
}
|
||||
} catch (e) {
|
||||
return '未安装StarRail-Plugin,无法查询'
|
||||
}
|
||||
}
|
||||
try {
|
||||
let uidRes = await fetch('https://avocado.wiki/v1/info/' + uid)
|
||||
uidRes = await uidRes.json()
|
||||
let { assistAvatar, displayAvatars } = uidRes.playerDetailInfo
|
||||
function dealAvatar (avatar) {
|
||||
delete avatar.position
|
||||
delete avatar.vo_tag
|
||||
delete avatar.desc
|
||||
delete avatar.promption
|
||||
delete avatar.relics
|
||||
delete avatar.behaviorList
|
||||
delete avatar.images
|
||||
delete avatar.ranks
|
||||
if (avatar.equipment) {
|
||||
avatar.equipment = {
|
||||
level: avatar.equipment.level,
|
||||
rank: avatar.equipment.rank,
|
||||
name: avatar.equipment.name,
|
||||
skill_desc: avatar.equipment.skill_desc
|
||||
}
|
||||
}
|
||||
}
|
||||
dealAvatar(assistAvatar)
|
||||
if (displayAvatars) {
|
||||
displayAvatars.forEach(avatar => {
|
||||
dealAvatar(avatar)
|
||||
})
|
||||
}
|
||||
uidRes.playerDetailInfo.assistAvatar = assistAvatar
|
||||
uidRes.playerDetailInfo.displayAvatars = displayAvatars
|
||||
delete uidRes.repository
|
||||
delete uidRes.version
|
||||
return `the player info in json format is: \n${JSON.stringify(uidRes)}`
|
||||
} catch (err) {
|
||||
return `failed to query, error: ${err.toString()}`
|
||||
}
|
||||
}
|
||||
|
||||
description = 'Useful when you want to query player information of Honkai Star Rail(崩坏:星穹铁道). '
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue