From 5dba8caa2fd9edac5d1f78b4203354531d8066d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?= <9903082+qdyovo@user.noreply.gitee.com> Date: Tue, 12 Nov 2024 13:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=B7=BB=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E4=BA=91=E7=9B=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/songRequest.js | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/apps/songRequest.js b/apps/songRequest.js index 01eed52..b4fe8a2 100644 --- a/apps/songRequest.js +++ b/apps/songRequest.js @@ -283,21 +283,14 @@ export class songRequest extends plugin { const title = msg.message[0].data.match(/"title":"([^"]+)"/)[1] const desc = msg.message[0].data.match(/"desc":"([^"]+)"/)[1] if (id === "") return - let paths = [ - this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.flac', - this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.mp3', - this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.mp4' - ]; - - for (let path of paths) { - try { - // 上传群文件 - await this.uploadGroupFile(e, path); - // 删除文件 - await checkAndRemoveFile(path); - } catch (error) { - logger.error(error); - } + let path = this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.flac' + try { + // 上传群文件 + await this.uploadGroupFile(e, path); + // 删除文件 + await checkAndRemoveFile(path); + } catch (error) { + logger.error(error); } } @@ -316,17 +309,11 @@ export class songRequest extends plugin { const title = msg.message[0].data.match(/"title":"([^"]+)"/)[1] const desc = msg.message[0].data.match(/"desc":"([^"]+)"/)[1] if (id === "") return - let paths = [ - this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.flac', - this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.mp3', - this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.mp4' - ]; - for (let path of paths) { - try { - await formData.append('songFile', fs.createReadStream(path)) - } catch (error) { - logger.error(error); - } + let path = this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.flac' + try { + await formData.append('songFile', fs.createReadStream(path)) + } catch (error) { + logger.error(error); } let formData = new FormData() const headers = { @@ -353,9 +340,9 @@ export class songRequest extends plugin { }).then(res => { logger.info('歌曲信息匹配成功') }) - .catch(error =>{ - logger.error('歌曲信息匹配错误',error) - }) + .catch(error => { + logger.error('歌曲信息匹配错误', error) + }) this.songCloudUpdate(e) } })