fix: 修复

This commit is contained in:
ikechan8370 2023-07-01 15:49:21 +08:00
parent 9838459446
commit f0b717bed8
23 changed files with 799 additions and 48 deletions

View file

@ -11,20 +11,20 @@ export class EditCardTool extends AbstractTool {
},
card: {
type: 'string',
description: '你想给他改的新名片'
description: 'the new card'
},
groupId: {
type: 'string',
description: '群号'
description: 'group number'
}
},
required: ['card', 'groupId']
}
description = '当你想要修改某个群员的群名片时有用。输入应该是群号、qq号和群名片用空格隔开。'
description = 'Useful when you want to edit someone\'s card in the group(群名片)'
func = async function (opts) {
let {qq, card, groupId} = opts
let { qq, card, groupId } = opts
groupId = parseInt(groupId.trim())
qq = parseInt(qq.trim())
logger.info('edit card: ', groupId, qq)

View file

@ -12,7 +12,7 @@ export class HandleMessageMsgTool extends AbstractTool {
},
messageId: {
type: 'string',
description: 'which message, current one by default'
description: 'which message to handle, current one by default'
}
},
required: ['type']

View file

@ -2,7 +2,7 @@ import { AbstractTool } from './AbstractTool.js'
import { getMasterQQ } from '../common.js'
export class QueryUserinfoTool extends AbstractTool {
name = 'sendDice'
name = 'queryUser'
parameters = {
properties: {

View file

@ -1,5 +1,4 @@
import {AbstractTool} from "./AbstractTool.js";
import { AbstractTool } from './AbstractTool.js'
export class SendDiceTool extends AbstractTool {
name = 'sendDice'
@ -19,7 +18,7 @@ export class SendDiceTool extends AbstractTool {
}
func = async function (opts) {
let {num, groupId} = opts
let { num, groupId } = opts
let groupList = await Bot.getGroupList()
if (groupList.get(groupId)) {
let group = await Bot.pickGroup(groupId, true)
@ -28,7 +27,7 @@ export class SendDiceTool extends AbstractTool {
let friend = await Bot.pickFriend(groupId)
await friend.sendMsg(segment.dice(num))
}
return `the dice has been sent`
return 'the dice has been sent'
}
description = 'If you want to roll dice, use this tool. If you know the group number, use the group number instead of the qq number first. The input should be the number of dice to be cast (1-6) and the target group number or qq numberand they should be concat with a space'

View file

@ -15,7 +15,7 @@ export class SendPictureTool extends AbstractTool {
},
groupId: {
type: 'string',
description: '群号或qq号发送目标为空则发送到当前聊天'
description: 'the group number or qq number, will send to current conversation if leave blank'
}
},
required: ['picture']

View file

@ -1,5 +1,5 @@
import { AbstractTool } from './AbstractTool.js'
import {Config} from "../config.js";
import {Config} from '../config.js';
export class WeatherTool extends AbstractTool {
name = 'weather'
@ -17,7 +17,9 @@ export class WeatherTool extends AbstractTool {
func = async function (opts) {
let { city } = opts
let key = Config.amapKey
if (!key) {
return 'query failed: you don\'t provide API key of 高德'
}
let adcodeRes = await fetch(`https://restapi.amap.com/v3/config/district?keywords=${city}&subdistrict=1&key=${key}`)
adcodeRes = await adcodeRes.json()
let adcode = adcodeRes.districts[0]?.adcode