fix: system api

This commit is contained in:
手瓜一十雪
2024-08-09 14:14:45 +08:00
parent 2093d68bfb
commit 6583e3d0c9

View File

@@ -1,24 +1,29 @@
import { NTEventDispatch } from '@/common/utils/EventTask'; import { GeneralCallResult, InstanceContext, NapCatCore } from '@/core';
import { GeneralCallResult, NTQQFileApi, NTQQUserApi, napCatCore } from '@/core';
export class NTQQSystemApi { export class NTQQSystemApi {
context: InstanceContext;
core: NapCatCore;
constructor(context: InstanceContext, core: NapCatCore) {
this.context = context;
this.core = core;
}
async hasOtherRunningQQProcess() { async hasOtherRunningQQProcess() {
return napCatCore.util.hasOtherRunningQQProcess(); return this.context.wrapper.util.hasOtherRunningQQProcess();
} }
async ORCImage(filePath: string) { async ORCImage(filePath: string) {
return napCatCore.session.getNodeMiscService().wantWinScreenOCR(filePath); return this.context.session.getNodeMiscService().wantWinScreenOCR(filePath);
} }
async translateEnWordToZn(words: string[]) { async translateEnWordToZn(words: string[]) {
return napCatCore.session.getRichMediaService().translateEnWordToZn(words); return this.context.session.getRichMediaService().translateEnWordToZn(words);
} }
//调用会超时 没灯用 (好像是通知listener的) onLineDev //调用会超时 没灯用 (好像是通知listener的) onLineDev
async getOnlineDev() { async getOnlineDev() {
return napCatCore.session.getMsgService().getOnLineDev(); return this.context.session.getMsgService().getOnLineDev();
} }
//1-2-162b9b42-65b9-4405-a8ed-2e256ec8aa50 //1-2-162b9b42-65b9-4405-a8ed-2e256ec8aa50
async getArkJsonCollection(cid: string) { async getArkJsonCollection(cid: string) {
const ret = await NTEventDispatch.CallNoListenerEvent const ret = await this.core.eventWrapper.callNoListenerEvent
<(cid: string) => Promise<GeneralCallResult & { arkJson: string }>>( <(cid: string) => Promise<GeneralCallResult & { arkJson: string }>>(
'NodeIKernelCollectionService/collectionArkShare', 'NodeIKernelCollectionService/collectionArkShare',
5000, 5000,
@@ -27,9 +32,9 @@ export class NTQQSystemApi {
return ret; return ret;
} }
async BootMiniApp(appfile: string, params: string) { async BootMiniApp(appfile: string, params: string) {
await napCatCore.session.getNodeMiscService().setMiniAppVersion('2.16.4'); await this.context.session.getNodeMiscService().setMiniAppVersion('2.16.4');
const c = await napCatCore.session.getNodeMiscService().getMiniAppPath(); const c = await this.context.session.getNodeMiscService().getMiniAppPath();
return napCatCore.session.getNodeMiscService().startNewMiniApp(appfile, params); return this.context.session.getNodeMiscService().startNewMiniApp(appfile, params);
} }
} }