From 32c3aa7979c4820d1f5fd660cf84a3d64c77d5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sun, 11 Aug 2024 17:53:15 +0800 Subject: [PATCH] fix: rm log error --- script/checkVersion.cjs | 4 ++-- src/common/utils/request.ts | 2 +- src/core/core.ts | 2 +- src/onebot/network/active-websocket.ts | 2 +- src/shell/napcat.ts | 1 + static/QQLogin.html | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/script/checkVersion.cjs b/script/checkVersion.cjs index 6863b9c9..1f62e0c0 100644 --- a/script/checkVersion.cjs +++ b/script/checkVersion.cjs @@ -11,7 +11,7 @@ try { // 验证 targetVersion 格式 if (!targetVersion || typeof targetVersion !== 'string') { - console.error("[NapCat] [CheckVersion] 目标版本格式不正确或未设置!"); + console.log("[NapCat] [CheckVersion] 目标版本格式不正确或未设置!"); return; } @@ -38,5 +38,5 @@ try { writeScriptToFile(safeScriptContent); } } catch (error) { - console.error("[NapCat] [CheckVersion] 检测过程中发生错误:", error); + console.log("[NapCat] [CheckVersion] 检测过程中发生错误:", error); } \ No newline at end of file diff --git a/src/common/utils/request.ts b/src/common/utils/request.ts index 22741a28..25b759fe 100644 --- a/src/common/utils/request.ts +++ b/src/common/utils/request.ts @@ -176,7 +176,7 @@ export class RequestUtil { req.on('error', (error) => { reject(error); - console.error('Error during upload:', error); + console.log('Error during upload:', error); }); const body = await RequestUtil.createFormData('WebKitFormBoundary7MA4YWxkTrZu0gW', filePath); diff --git a/src/core/core.ts b/src/core/core.ts index a1ad5792..bdb357e5 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -43,7 +43,6 @@ export class NapCatCore { this.context = context; this.util = new this.context.wrapper.NodeQQNTWrapperUtil(); this.eventWrapper = new LegacyNTEventWrapper(context.wrapper, context.session); - this.initNapCatCoreListeners().then().catch(console.error); this.ApiContext = { FileApi: new NTQQFileApi(this.context, this), SystemApi: new NTQQSystemApi(this.context, this), @@ -61,6 +60,7 @@ export class NapCatCore { if (!fs.existsSync(this.NapCatTempPath)) { fs.mkdirSync(this.NapCatTempPath, { recursive: true }); } + this.initNapCatCoreListeners().then().catch(this.context.logger.logError); } getApiContext() { diff --git a/src/onebot/network/active-websocket.ts b/src/onebot/network/active-websocket.ts index eb54a7e2..2ed2ebfc 100644 --- a/src/onebot/network/active-websocket.ts +++ b/src/onebot/network/active-websocket.ts @@ -85,7 +85,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter { this.registerHeartBeat(); } catch (e) { this.connection = null; - console.error('Failed to connect to the server, retrying in 5 seconds...'); + console.log('Failed to connect to the server, retrying in 5 seconds...'); await sleep(5000); } } diff --git a/src/shell/napcat.ts b/src/shell/napcat.ts index 9bbdc884..2c81ff3a 100644 --- a/src/shell/napcat.ts +++ b/src/shell/napcat.ts @@ -109,6 +109,7 @@ export async function NCoreInitShell() { const qrcodePath = path.join(dataPath, 'qrcode.png'); qrcode.generate(qrcodeUrl, { small: true }, (res) => { logger.logWarn([ + '\n', res, '二维码解码URL: ' + qrcodeUrl, '如果控制台二维码无法扫码,可以复制解码url到二维码生成网站生成二维码再扫码,也可以打开下方的二维码路径图片进行扫码。', diff --git a/static/QQLogin.html b/static/QQLogin.html index 0307263d..0714ebf6 100644 --- a/static/QQLogin.html +++ b/static/QQLogin.html @@ -283,7 +283,7 @@ function generateQrCode(data, canvas) { QRCode.toCanvas(canvas, data, function (error) { - if (error) console.error(error); + if (error) console.log(error); console.log('QR Code generated!'); }); }