From 6157a19e1275df65d1b11f5f17ba60092223b97b Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Wed, 24 Jul 2024 16:45:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=84=20reactor:=20`=E4=BB=A4=E7=89=8C?= =?UTF-8?q?=E6=A1=B6`=20=E6=B7=B1=E5=BA=A6=E6=B8=85=E6=B4=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index be7d49a..b914d5c 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -325,9 +325,12 @@ export class tools extends plugin { // logger.info(resUrl); const path = `${ this.getCurDownloadPath(e) }/temp.mp4`; - await this.downloadVideo(resUrl).then(() => { - this.sendVideoToUpload(e, path) - }); + // 加入队列 + this.queue.add(async () => { + await this.downloadVideo(resUrl).then(() => { + this.sendVideoToUpload(e, path) + }); + }) } else if (urlType === "image") { // 发送描述 e.reply(`识别:抖音, ${ item.desc }`); @@ -579,22 +582,25 @@ export class tools extends plugin { // 创建文件,如果不存在 const path = `${ this.getCurDownloadPath(e) }/`; await mkdirIfNotExists(path); - // 下载文件 - getDownloadUrl(url) - .then(data => { - this.downBili(`${ path }temp`, data.videoUrl, data.audioUrl) - .then(_ => { - this.sendVideoToUpload(e, `${ path }temp.mp4`) - }) - .catch(err => { - logger.error(err); - e.reply("解析失败,请重试一下"); - }); - }) - .catch(err => { - logger.error(err); - e.reply("解析失败,请重试一下"); - }); + // 加入队列 + this.queue.add(async () => { + // 下载文件 + getDownloadUrl(url) + .then(data => { + this.downBili(`${ path }temp`, data.videoUrl, data.audioUrl) + .then(_ => { + this.sendVideoToUpload(e, `${ path }temp.mp4`) + }) + .catch(err => { + logger.error(err); + e.reply("解析失败,请重试一下"); + }); + }) + .catch(err => { + logger.error(err); + e.reply("解析失败,请重试一下"); + }); + }) return true; }