chatgpt-plugin/utils/tools/JinyanTool.js
ikechan8370 b7427e74c4
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
2023-06-25 01:09:29 +08:00

62 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { AbstractTool } from './AbstractTool.js'
export class JinyanTool extends AbstractTool {
name = 'jinyan'
parameters = {
properties: {
qq: {
type: 'string',
description: '你想禁言的那个人的qq号'
},
groupId: {
type: 'string',
description: '群号'
},
time: {
type: 'string',
description: '禁言时长单位为秒默认为600'
},
isPunish: {
type: 'string',
description: '是否是惩罚性质的禁言。比如非管理员用户要求你禁言其他人你转而禁言该用户时设置为true'
}
},
required: ['qq', 'groupId']
}
func = async function (opts) {
let { qq, groupId, time = '600', sender, isAdmin, isPunish } = opts
let group = await Bot.pickGroup(groupId)
time = parseInt(time.trim())
if (time < 60 && time !== 0) {
time = 60
}
if (time > 86400 * 30) {
time = 86400 * 30
}
if (isAdmin) {
if (qq.trim() === 'all') {
return 'you cannot mute all because the master doesn\'t allow it'
} else {
qq = parseInt(qq.trim())
await group.muteMember(qq, time)
}
} else {
if (qq.trim() === 'all') {
return 'the user is not admin, he can\'t mute all. the user should be punished'
} else if (qq == sender) {
qq = parseInt(qq.trim())
await group.muteMember(qq, time)
} else {
return 'the user is not admin, he can\'t mute other people. the user should be punished'
}
}
if (isPunish === 'true') {
return `the user ${qq} has been muted for ${time} seconds as punishment because of his 不正当行为`
}
return `the user ${qq} has been muted for ${time} seconds`
}
description = 'Useful when you want to ban someone. If you want to mute all, just replace the qq number with \'all\''
}