From e65c8244dbcfdd2602fe9c213c69d7f4fc3f4e95 Mon Sep 17 00:00:00 2001 From: zhiyu1998 Date: Sun, 12 Mar 2023 13:23:21 +0800 Subject: [PATCH] =?UTF-8?q?=E2=86=A9=20revert:=20=E9=80=80=E5=9B=9E?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 13 +++++++------ config/version.yaml | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index a56358e..6a6eaec 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -644,13 +644,14 @@ export class tools extends plugin { async netease(e) { const message = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim(); const musicUrlReg = /(http:|https:)\/\/music.163.com\/song\/media\/outer\/url\?id=(\d+)/; - const musicUrl = musicUrlReg.exec(message) - const musicDownloadUrl = musicUrl?.[0] // 如果存在直接内容 - if (musicDownloadUrl) { - const musicJson = JSON.parse(message) - const {musicUrl, preview, title, desc} = musicJson.meta.music - console.log(111); + const musicJson = JSON.parse(message) + const {musicUrl, preview, title, desc} = musicJson.meta.music + // 如果没有下载地址跳出if + if (_.isNull(musicUrl) || _.isUndefined(musicUrl)) { + e.reply(`识别:网易云音乐,官方解析失败,开始执行第三方解析!`); + } else { + // 反之解析官方地址 e.reply([`识别:网易云音乐,${title}--${desc}`, segment.image(preview)]); await this.downloadMp3(musicUrl, 'follow').then(path => { Bot.acquireGfs(e.group_id).upload(fs.readFileSync(path), '/', `${title.replace(/[\/\?<>\\:\*\|".… ]/g, '')}.mp3`) diff --git a/config/version.yaml b/config/version.yaml index aa2d300..8ebf26c 100644 --- a/config/version.yaml +++ b/config/version.yaml @@ -1,10 +1,10 @@ - { - version: 1.0.10, + version: 1.0.9, data: [ - 新增网易云小程序解析, - 适配bilibili小程序解析, + 适配bilibili小程序解析查询, 增加#搜书查询, + 增加#青年大学习查询, 适配锅巴插件,方便查看和修改配置, 添加#R帮助获取插件帮助, 添加#R版本获取插件版本,