From 66c2fd228f178b6d9b088ef63b8ae970435ed327 Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Sun, 23 Jun 2024 17:25:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D=20bodi?= =?UTF-8?q?an=20=E6=97=A0=E6=B3=95=E5=8F=91=E9=80=81=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 2 +- utils/bodian.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 }`); });