mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: 修复 bodian 无法发送的问题
This commit is contained in:
parent
7ae76b6143
commit
66c2fd228f
@ -945,7 +945,7 @@ export class tools extends plugin {
|
|||||||
]);
|
]);
|
||||||
if (e.msg.includes("musicId")) {
|
if (e.msg.includes("musicId")) {
|
||||||
const path = `${ this.getCurDownloadPath(e) }`;
|
const path = `${ this.getCurDownloadPath(e) }`;
|
||||||
await getBodianAudio(id, path).then(sendPath => {
|
await getBodianAudio(id, path, `${ name }-${ artist }`).then(sendPath => {
|
||||||
// 发送语音
|
// 发送语音
|
||||||
e.reply(segment.record(sendPath));
|
e.reply(segment.record(sendPath));
|
||||||
// 上传群文件
|
// 上传群文件
|
||||||
|
@ -5,9 +5,10 @@ import { downloadAudio, generateRandomStr } from "./common.js";
|
|||||||
* 获取音频
|
* 获取音频
|
||||||
* @param id
|
* @param id
|
||||||
* @param path
|
* @param path
|
||||||
|
* @param songName
|
||||||
* @returns {Promise<any>}
|
* @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 API = `https://bd-api.kuwo.cn/api/service/music/audioUrl/${id}?format=mp3&br=320kmp3&songType=&fromList=&weListenUid=&weListenDevId=`;
|
||||||
const headers = {
|
const headers = {
|
||||||
@ -26,7 +27,7 @@ async function getBodianAudio(id, path) {
|
|||||||
});
|
});
|
||||||
const respJson = resp.data;
|
const respJson = resp.data;
|
||||||
const audioUrl = respJson.data.audioUrl;
|
const audioUrl = respJson.data.audioUrl;
|
||||||
return await downloadAudio(audioUrl, path)
|
return await downloadAudio(audioUrl, path, songName)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(`下载音乐失败,错误信息为: ${ err.message }`);
|
console.error(`下载音乐失败,错误信息为: ${ err.message }`);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user