feat: 适配汽水音乐的链接分享

This commit is contained in:
zhiyu1998 2024-08-02 09:50:54 +08:00
parent f5aabaea42
commit 70d6f84589

View File

@ -189,6 +189,10 @@ export class tools extends plugin {
{
reg: "(y.qq.com)",
fnc: "qqMusic"
},
{
reg: "(qishui.douyin.com)",
fnc: "qishuiMusic"
}
],
});
@ -1790,6 +1794,26 @@ export class tools extends plugin {
return true;
}
// 汽水音乐
async qishuiMusic(e) {
const normalRegex = /^(.*?)\s*https?:\/\//;
const musicInfo = normalRegex.exec(e.msg)?.[1].trim();
logger.info(`[R插件][qishuiMusic] 识别音乐为:${musicInfo}`);
// 使用临时接口下载
const url = await this.musicTempApi(e, musicInfo, "汽水音乐");
// 下载音乐
await downloadAudio(url, this.getCurDownloadPath(e), musicInfo, 'follow').then(async path => {
// 发送语音
await e.reply(segment.record(path));
// 判断是不是icqq
await this.uploadGroupFile(e, path);
await checkAndRemoveFile(path);
}).catch(err => {
logger.error(`下载音乐失败,错误信息为: ${ err.message }`);
});
return true;
}
/**
* 哔哩哔哩下载
* @param title