🐞 fix: 修复 bodian 无法发送的问题

This commit is contained in:
zhiyu1998 2024-06-23 17:25:02 +08:00
parent 7ae76b6143
commit 66c2fd228f
2 changed files with 4 additions and 3 deletions

View File

@ -945,7 +945,7 @@ export class tools extends plugin {
]);
if (e.msg.includes("musicId")) {
const path = `${ this.getCurDownloadPath(e) }`;
await getBodianAudio(id, path).then(sendPath => {
await getBodianAudio(id, path, `${ name }-${ artist }`).then(sendPath => {
// 发送语音
e.reply(segment.record(sendPath));
// 上传群文件

View File

@ -5,9 +5,10 @@ import { downloadAudio, generateRandomStr } from "./common.js";
* 获取音频
* @param id
* @param path
* @param songName
* @returns {Promise<any>}
*/
async function getBodianAudio(id, path) {
async function getBodianAudio(id, path, songName = "temp") {
// 音乐数据
const API = `https://bd-api.kuwo.cn/api/service/music/audioUrl/${id}?format=mp3&br=320kmp3&songType=&fromList=&weListenUid=&weListenDevId=`;
const headers = {
@ -26,7 +27,7 @@ async function getBodianAudio(id, path) {
});
const respJson = resp.data;
const audioUrl = respJson.data.audioUrl;
return await downloadAudio(audioUrl, path)
return await downloadAudio(audioUrl, path, songName)
.catch(err => {
console.error(`下载音乐失败,错误信息为: ${ err.message }`);
});