From 012191eab5b71122626a60942e67060d610bd9c2 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 15:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9C=A8=E6=96=87=E4=BB=B6=E6=8B=93=E5=B1=95=E5=90=8D=E4=B8=BA?= =?UTF-8?q?mp3=E6=97=A0=E6=B3=95=E4=B8=8A=E4=BC=A0=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/songRequest.js | 7 +++++-- apps/tools.js | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/songRequest.js b/apps/songRequest.js index ba15eea..76e4bad 100644 --- a/apps/songRequest.js +++ b/apps/songRequest.js @@ -13,6 +13,8 @@ import { sendMusicCard } from "../utils/yunzai-util.js"; import config from "../model/config.js"; import FormData from 'form-data'; +let FileSuffix = 'flac' + export class songRequest extends plugin { constructor() { super({ @@ -282,7 +284,7 @@ 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 path = this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.flac' + let path = this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.' + FileSuffix try { // 上传群文件 await this.uploadGroupFile(e, path); @@ -308,7 +310,7 @@ 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 path = this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.flac' + let path = this.getCurDownloadPath(e) + '/' + title + '-' + desc + '.' + FileSuffix let tryCount = 0 const tryUpload = async () => { let formData = new FormData() @@ -537,6 +539,7 @@ export class songRequest extends plugin { } // 动态判断后缀名 let musicExt = resp.data.data?.[0]?.type + FileSuffix = musicExt // 下载音乐 downloadAudio(url, this.getCurDownloadPath(e), title, 'follow', musicExt).then(async path => { try { diff --git a/apps/tools.js b/apps/tools.js index e2a3f6c..71e9aef 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -107,6 +107,8 @@ import { convertToSeconds, removeParams, ytbFormatTime } from "../utils/youtube. import { ytDlpGetDuration, ytDlpGetThumbnail, ytDlpGetTilt, ytDlpHelper } from "../utils/yt-dlp-util.js"; import { textArrayToMakeForward, sendMusicCard } from "../utils/yunzai-util.js"; + + export class tools extends plugin { /** * 用于计数applemusic,达到一定数量清理文件