From 5669e2b0b719bfb5e30dbe199bc731accda3336e 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, 8 Sep 2024 18:21:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B7=9F=E8=BF=9B=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/services/NodeIKernelLoginService.ts | 1 + src/shell/napcat.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/services/NodeIKernelLoginService.ts b/src/core/services/NodeIKernelLoginService.ts index 9cd7635f..686edde0 100644 --- a/src/core/services/NodeIKernelLoginService.ts +++ b/src/core/services/NodeIKernelLoginService.ts @@ -59,6 +59,7 @@ export interface QuickLoginResult { } export interface NodeIKernelLoginService { + connect(): boolean; // eslint-disable-next-line @typescript-eslint/no-misused-new new(): NodeIKernelLoginService; diff --git a/src/shell/napcat.ts b/src/shell/napcat.ts index 0f9e11b9..88c774a8 100644 --- a/src/shell/napcat.ts +++ b/src/shell/napcat.ts @@ -150,7 +150,12 @@ export async function NCoreInitShell() { }; loginService.addKernelLoginListener(proxiedListenerOf(loginListener, logger) as any); - + let isConnect = loginService.connect(); + if (!isConnect) { + logger.logError('核心登录服务连接失败!'); + return; + } + logger.log('核心登录服务连接成功!'); // 实现WebUi快速登录 loginService.getLoginList().then((res) => { // 遍历 res.LocalLoginInfoList[x].isQuickLogin是否可以 res.LocalLoginInfoList[x].uin 转为string 加入string[] 最后遍历完成调用WebUiDataRuntime.setQQQuickLoginList @@ -199,7 +204,7 @@ export async function NCoreInitShell() { logger.log(`可用于快速登录的 QQ:\n${historyLoginList .map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`) .join('\n') - }`); + }`); } loginService.getQRCodePicture(); }