From d33a872c427c54f63302e052517f2c72f4f0e3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E6=9B=A6?= <2218872014@qq.com> Date: Sun, 1 Feb 2026 09:53:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=B9=B6=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=B8=8A=E4=BC=A0=E8=B5=84=E6=BA=90=E6=97=A5=E5=BF=97?= =?UTF-8?q?=20(#1573)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当上传资源有失败时为warn 全部成功则不输出日志 --- .../packet/context/operationContext.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/napcat-core/packet/context/operationContext.ts b/packages/napcat-core/packet/context/operationContext.ts index df5e250a..34a2bde0 100644 --- a/packages/napcat-core/packet/context/operationContext.ts +++ b/packages/napcat-core/packet/context/operationContext.ts @@ -95,12 +95,15 @@ export class PacketOperationContext { .filter(Boolean) ); const res = await Promise.allSettled(reqList); - this.context.logger.info(`上传资源${res.length}个,失败${res.filter((r) => r.status === 'rejected').length}个`); - res.forEach((result, index) => { - if (result.status === 'rejected') { - this.context.logger.error(`上传第${index + 1}个资源失败:${result.reason.stack}`); - } - }); + const failedCount = res.filter((r) => r.status === 'rejected').length; + if (failedCount > 0) { + this.context.logger.warn(`上传资源${res.length}个,失败${failedCount}个`); + res.forEach((result, index) => { + if (result.status === 'rejected') { + this.context.logger.error(`上传第${index + 1}个资源失败:${result.reason.stack}`); + } + }); + } } async UploadImage (img: PacketMsgPicElement) {