mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
33 lines
820 B
JavaScript
33 lines
820 B
JavaScript
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', 'groupId']
|
||
}
|
||
|
||
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'
|
||
}
|