fix: move send avatar into send picture tool

This commit is contained in:
ikechan8370 2023-06-25 01:08:13 +08:00
parent c375cba335
commit 4df97c7044
2 changed files with 12 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import {AbstractTool} from "./AbstractTool.js";
import { AbstractTool } from './AbstractTool.js'
export class SendAvatarTool extends AbstractTool {
name = 'sendAvatar'
@ -18,7 +18,7 @@ export class SendAvatarTool extends AbstractTool {
}
func = async function (opts) {
let {qq, groupId} = opts
let { qq, groupId } = opts
let groupList = await Bot.getGroupList()
groupId = parseInt(groupId.trim())
console.log('sendAvatar', groupId, qq)

View file

@ -7,7 +7,11 @@ export class SendPictureTool extends AbstractTool {
properties: {
picture: {
type: 'string',
description: 'the url of the pictures, split with space if more than one '
description: 'the url of the pictures, split with space if more than one.'
},
qq: {
type: 'string',
description: 'if you want to send avatar of a user, input his qq number.'
},
groupId: {
type: 'string',
@ -18,7 +22,11 @@ export class SendPictureTool extends AbstractTool {
}
func = async function (opt) {
let { picture, groupId } = opt
let { picture, groupId, qq } = opt
if (qq) {
let avatar = `https://q1.qlogo.cn/g?b=qq&s=0&nk=${qq}`
picture += ' ' + avatar
}
let pictures = picture.trim().split(' ')
pictures = pictures.map(img => segment.image(img))
let groupList = await Bot.getGroupList()