diff --git a/apps/tools.js b/apps/tools.js index 4bc4c29..87271b1 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -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)); // 上传群文件 diff --git a/utils/bodian.js b/utils/bodian.js index 3a0df2b..686bb14 100644 --- a/utils/bodian.js +++ b/utils/bodian.js @@ -5,9 +5,10 @@ import { downloadAudio, generateRandomStr } from "./common.js"; * 获取音频 * @param id * @param path + * @param songName * @returns {Promise} */ -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 }`); });