🦄 reactor: 支持发送音乐卡片

This commit is contained in:
秋刀鱼 2024-11-05 13:51:13 +08:00
parent 5dbf6f13af
commit a294bcd3bb

View File

@ -275,10 +275,31 @@ export class songRequest extends plugin {
let musicExt = resp.data.data?.[0]?.type let musicExt = resp.data.data?.[0]?.type
// 下载音乐 // 下载音乐
downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => { downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => {
try {
await e.bot.sendApi('send_group_msg', {
group_id: e.group.group_id,
message: [
{
type: 'music',
data: {
type: '163',
id: songInfo[pickNumber].id
}
}
]
});
} catch (error) {
// 发送语音 // 发送语音
if (error.error.message) {
logger.error("发送卡片错误错误:", error.error.message, '发送群语音');
} else {
logger.error("发送卡片错误错误,请查看控制台报错,将发送群语音")
logger.error(error)
}
if (musicExt != 'mp4') { if (musicExt != 'mp4') {
await e.reply(segment.record(path)); await e.reply(segment.record(path));
} }
}
// 上传群文件 // 上传群文件
await this.uploadGroupFile(e, path); await this.uploadGroupFile(e, path);
// 删除文件 // 删除文件