From 4cbaf0dc704a5bef48e106fe1bf7a3470b5d0056 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: Sat, 10 Aug 2024 21:53:08 +0800 Subject: [PATCH] fix --- 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 17d0c36d..10f6a0a0 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -1,4 +1,4 @@ -import { NTApiContext, WrapperNodeApi } from '@/core/wrapper'; +import { NodeQQNTWrapperUtil, NTApiContext, WrapperNodeApi } from '@/core/wrapper'; import path from 'node:path'; import fs from 'node:fs'; import { InstanceContext } from './wrapper'; @@ -35,11 +35,13 @@ export class NapCatCore { NapCatTempPath: string; // runtime info, not readonly selfInfo: SelfInfo; + util: NodeQQNTWrapperUtil; // 通过构造器递过去的 runtime info 应该尽量少 constructor(context: InstanceContext, selfInfo: SelfInfo) { this.selfInfo = selfInfo; 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 = { @@ -66,7 +68,7 @@ export class NapCatCore { } get dataPath(): string { - let result = this.context.wrapper.util.getNTUserDataInfoConfig(); + let result = this.util.getNTUserDataInfoConfig(); if (!result) { result = path.resolve(os.homedir(), './.config/QQ'); fs.mkdirSync(result, { recursive: true });