chatgpt-plugin/utils/tools/EditCardTool.js
2023-07-01 15:49:21 +08:00

35 lines
917 B
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 EditCardTool extends AbstractTool {
name = 'editCard'
parameters = {
properties: {
qq: {
type: 'string',
description: '你想改名片的那个人的qq号默认为聊天对象'
},
card: {
type: 'string',
description: 'the new card'
},
groupId: {
type: 'string',
description: 'group number'
}
},
required: ['card', 'groupId']
}
description = 'Useful when you want to edit someone\'s card in the group(群名片)'
func = async function (opts) {
let { qq, card, groupId } = opts
groupId = parseInt(groupId.trim())
qq = parseInt(qq.trim())
logger.info('edit card: ', groupId, qq)
let group = await Bot.pickGroup(groupId)
await group.setCard(qq, card)
return `the user ${qq}'s card has been changed into ${card}`
}
}