diff --git a/apps/chat.js b/apps/chat.js index cb0ee43..00219bb 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -1960,7 +1960,7 @@ export class chatgpt extends plugin { logger.info(msg) while (msg.functionCall) { let { name, arguments: args } = msg.functionCall - let functionResult = await funcMap[name].exec(Object.assign({isAdmin, sender}, JSON.parse(args))) + let functionResult = await funcMap[name].exec(Object.assign({ isAdmin, sender }, JSON.parse(args))) logger.mark(`function ${name} execution result: ${functionResult}`) option.parentMessageId = msg.id option.name = name diff --git a/utils/tools/JinyanTool.js b/utils/tools/JinyanTool.js index 7130284..5dff582 100644 --- a/utils/tools/JinyanTool.js +++ b/utils/tools/JinyanTool.js @@ -16,13 +16,17 @@ export class JinyanTool extends AbstractTool { time: { type: 'string', description: '禁言时长,单位为秒' + }, + isPunish: { + type: 'bool', + description: '是否是惩罚性质的禁言。比如非管理员用户要求你禁言其他人,你转而禁言该用户时设置为true' } }, required: ['qq', 'groupId'] } func = async function (opts) { - let { qq, groupId, time = '600', sender, isAdmin } = opts + let { qq, groupId, time = '600', sender, isAdmin, isPunish } = opts let group = await Bot.pickGroup(groupId) time = parseInt(time.trim()) if (time < 60) { @@ -48,6 +52,9 @@ export class JinyanTool extends AbstractTool { return 'the user is not admin, he can\'t mute other people. the user should be punished' } } + if (isPunish) { + 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` } diff --git a/utils/tools/KickOutTool.js b/utils/tools/KickOutTool.js index c7c04f0..ba6d457 100644 --- a/utils/tools/KickOutTool.js +++ b/utils/tools/KickOutTool.js @@ -13,13 +13,17 @@ export class KickOutTool extends AbstractTool { groupId: { type: 'string', description: '群号' + }, + isPunish: { + type: 'bool', + description: '是否是惩罚性质的踢出。比如非管理员用户要求你禁言或踢出其他人,你为惩罚该用户转而踢出该用户时设置为true' } }, required: ['qq', 'groupId'] } func = async function (opts) { - let { qq, groupId, sender, isAdmin } = opts + let { qq, groupId, sender, isAdmin, isPunish } = opts groupId = parseInt(groupId.trim()) qq = parseInt(qq.trim()) if (!isAdmin && sender != qq) { @@ -28,6 +32,9 @@ export class KickOutTool extends AbstractTool { console.log('kickout', groupId, qq) let group = await Bot.pickGroup(groupId) await group.kickMember(qq) + if (isPunish) { + return `the user ${qq} has been kicked out from group ${groupId} as punishment because of his 不正当行为` + } return `the user ${qq} has been kicked out from group ${groupId}` }