chatgpt-plugin/utils/tools/SendMusicTool.js
2023-06-26 13:17:14 +08:00

33 lines
842 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 SendMusicTool extends AbstractTool {
name = 'sendMusic'
parameters = {
properties: {
id: {
type: 'string',
description: '音乐的id'
},
groupId: {
type: 'string',
description: '群号或qq号发送目标为空则发送到当前聊天'
}
},
required: ['keyword']
}
func = async function (opts) {
let { id, groupId } = opts
groupId = parseInt(groupId.trim())
try {
let group = await Bot.pickGroup(groupId)
await group.shareMusic('163', id)
return `the music has been shared to ${groupId}`
} catch (e) {
return `music share failed: ${e}`
}
}
description = 'Useful when you want to share music. You must use searchMusic first to get the music id'
}