From 755ab36e83a7dc4a768a526e76c6164bf70bf0c5 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: Thu, 8 Aug 2024 21:23:14 +0800 Subject: [PATCH] chore: loadfinish --- src/core/core.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/core.ts b/src/core/core.ts index 56afb9f6..1fbf1316 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -5,6 +5,7 @@ import { InstanceContext } from "./wrapper"; import { NTEventChannel } from "@/common/framework/event"; import { proxiedListenerOf } from "@/common/utils/proxy-handler"; import { MsgListener } from "./listeners"; +import { sleep } from "@/common/utils/helper"; export enum NapCatCoreWorkingEnv { Unknown = 0, @@ -29,15 +30,16 @@ export class NapCatCore { constructor(context: InstanceContext) { this.context = context; this.eventChannel = new NTEventChannel(context.wrapper, context.session); - this.initNapCatCoreListeners(); + this.initNapCatCoreListeners().then().catch(console.error); } // Renamed from 'InitDataListener' - initNapCatCoreListeners() { + async initNapCatCoreListeners() { let msg = new MsgListener(); msg.onRecvMsg = (msg) => { console.log("RecvMsg", msg); } + await sleep(2500); this.context.session.getMsgService().addKernelMsgListener( new this.context.wrapper.NodeIKernelMsgListener(proxiedListenerOf(msg, this.context.logger)) );