mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: search file
This commit is contained in:
@@ -146,6 +146,7 @@ export class NTEventWrapper {
|
||||
this.EventTask.get(ListenerMainName)?.set(ListenerSubName, new Map());
|
||||
}
|
||||
this.EventTask.get(ListenerMainName)?.get(ListenerSubName)?.set(id, eventCallbak);
|
||||
this.CreatListenerFunction(ListenerMainName);
|
||||
});
|
||||
}
|
||||
async CallNormalEvent<EventType extends (...args: any[]) => Promise<any>, ListenerType extends (...args: any[]) => void>
|
||||
|
@@ -19,6 +19,7 @@ import { rkeyManager } from '../utils/rkey';
|
||||
import { NTEventDispatch } from '@/common/utils/EventTask';
|
||||
import { NodeIKernelSearchService } from '../services/NodeIKernelSearchService';
|
||||
|
||||
|
||||
export class NTQQFileApi {
|
||||
static async getFileType(filePath: string) {
|
||||
return fileType.fileTypeFromFile(filePath);
|
||||
@@ -147,7 +148,6 @@ export class NTQQFileApi {
|
||||
});
|
||||
}
|
||||
static async searchfile(keys: string[]) {
|
||||
|
||||
type EventType = NodeIKernelSearchService['searchFileWithKeywords'];
|
||||
interface OnListener {
|
||||
searchId: string,
|
||||
@@ -187,22 +187,17 @@ export class NTQQFileApi {
|
||||
}[]
|
||||
}[]
|
||||
};
|
||||
// (params: OnListener) => void 'NodeIKernelSearchListener/onSearchFileKeywordsResult',
|
||||
// 1,
|
||||
// 10000,
|
||||
// (arg): boolean => { return id == data.searchId },
|
||||
// keys,
|
||||
// 12
|
||||
const Event = await NTEventDispatch.CreatEventFunction<EventType>('NodeIKernelSearchService/searchFileWithKeywords');
|
||||
let id = '';
|
||||
const [Listener] = await NTEventDispatch.RegisterListen<(params: OnListener) => void>('NodeIKernelSearchListener/onSearchFileKeywordsResult', 1, 5000, (params) => {
|
||||
const Listener = NTEventDispatch.RegisterListen<(params: OnListener) => void>('NodeIKernelSearchListener/onSearchFileKeywordsResult', 1, 20000, (params) => {
|
||||
if (id !== '' && params.searchId == id) {
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
});
|
||||
id = await Event!(keys, 12);
|
||||
return Listener.resultItems[0];
|
||||
let [ret] = (await Listener);
|
||||
return ret;
|
||||
}
|
||||
static async getImageUrl(element: PicElement) {
|
||||
if (!element) {
|
||||
|
@@ -1,11 +1,11 @@
|
||||
|
||||
|
||||
import { NTEventDispatch } from '@/common/utils/EventTask';
|
||||
import { GeneralCallResult, NTQQUserApi, napCatCore } from '@/core';
|
||||
// setTimeout(async () => {
|
||||
// let ret = await NTQQSystemApi.getArkJsonCollection('1-2-162b9b42-65b9-4405-a8ed-2e256ec8aa50');
|
||||
// console.log(ret);
|
||||
// }, 20000)
|
||||
import { GeneralCallResult, NTQQFileApi, NTQQUserApi, napCatCore } from '@/core';
|
||||
setTimeout(async () => {
|
||||
let ret = await NTQQFileApi.searchfile(['doc']);
|
||||
console.log(ret);
|
||||
}, 20000)
|
||||
export class NTQQSystemApi {
|
||||
static async hasOtherRunningQQProcess() {
|
||||
return napCatCore.util.hasOtherRunningQQProcess();
|
||||
|
Reference in New Issue
Block a user