Merge branch 'v2' of github.com:ikechan8370/chatgpt-plugin into v2

This commit is contained in:
ikechan8370 2025-02-26 22:23:24 +08:00
commit cf31d40cf4
2 changed files with 18 additions and 1 deletions

View file

@ -15,6 +15,8 @@
> 由于相关领域发展快速迭代较多本文档有部分过时内容不确定的问题可以开discussion或加群问群里的大佬们哦
>
> 插件大幅重构中v2分支仅做最低程度维护。
### 推荐的相关文档和参考资料
本README

View file

@ -27,7 +27,22 @@ export class SendMusicTool extends AbstractTool {
try {
let group = await e.bot.pickGroup(target)
await group.shareMusic('163', id)
// 检查是否支持 shareMusic 方法
if (typeof group.shareMusic === 'function') {
await group.shareMusic('163', id)
} else {
// 构建音乐分享消息
const musicMsg = {
type: 'music',
data: {
type: '163',
id: id,
jumpUrl: `https://music.163.com/#/song?id=${id}`
}
}
await e.reply(musicMsg)
}
return `the music has been shared to ${target}`
} catch (e) {
return `music share failed: ${e}`