This commit is contained in:
idranme 2024-08-09 14:26:30 +08:00
parent c5b69561af
commit 6c8d3db3a4
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
4 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,7 @@ import { GroupDecreaseSubType, OB11GroupDecreaseEvent } from '../onebot11/event/
import '../ntqqapi/wrapper' import '../ntqqapi/wrapper'
import { sentMessages } from '@/ntqqapi/api' import { sentMessages } from '@/ntqqapi/api'
import { NTEventDispatch } from '../common/utils/EventTask' import { NTEventDispatch } from '../common/utils/EventTask'
import { wrapperApi, wrapperConstructor } from '../ntqqapi/wrapper' import { wrapperConstructor, getSession } from '../ntqqapi/wrapper'
let mainWindow: BrowserWindow | null = null let mainWindow: BrowserWindow | null = null
@ -441,7 +441,7 @@ function onLoad() {
uidMaps[value] = key uidMaps[value] = key
} }
}) })
NTEventDispatch.init({ ListenerMap: wrapperConstructor, WrapperSession: wrapperApi.NodeIQQNTWrapperSession! }) NTEventDispatch.init({ ListenerMap: wrapperConstructor, WrapperSession: getSession()! })
log('start activate group member info') log('start activate group member info')
NTQQGroupApi.activateMemberInfoChange().then().catch(log) NTQQGroupApi.activateMemberInfoChange().then().catch(log)
NTQQGroupApi.activateMemberListChange().then().catch(log) NTQQGroupApi.activateMemberListChange().then().catch(log)

View File

@ -16,12 +16,12 @@ import fs from 'node:fs'
import { ReceiveCmdS } from '../hook' import { ReceiveCmdS } from '../hook'
import { log } from '@/common/utils' import { log } from '@/common/utils'
import { rkeyManager } from '@/ntqqapi/api/rkey' import { rkeyManager } from '@/ntqqapi/api/rkey'
import { wrapperApi } from '@/ntqqapi/wrapper' import { getSession } from '@/ntqqapi/wrapper'
import { Peer } from '@/ntqqapi/types/msg' import { Peer } from '@/ntqqapi/types/msg'
export class NTQQFileApi { export class NTQQFileApi {
static async getVideoUrl(peer: Peer, msgId: string, elementId: string): Promise<string> { static async getVideoUrl(peer: Peer, msgId: string, elementId: string): Promise<string> {
const session = wrapperApi.NodeIQQNTWrapperSession const session = getSession()
return (await session?.getRichMediaService().getVideoPlayUrlV2(peer, return (await session?.getRichMediaService().getVideoPlayUrlV2(peer,
msgId, msgId,
elementId, elementId,

View File

@ -6,7 +6,7 @@ import { ReceiveCmdS, registerReceiveHook } from '../hook'
import { log } from '../../common/utils/log' import { log } from '../../common/utils/log'
import { sleep } from '../../common/utils/helper' import { sleep } from '../../common/utils/helper'
import { isQQ998 } from '../../common/utils' import { isQQ998 } from '../../common/utils'
import { wrapperApi } from '@/ntqqapi/wrapper' import { getSession } from '@/ntqqapi/wrapper'
export let sendMessagePool: Record<string, ((sendSuccessMsg: RawMessage) => void) | null> = {} // peerUid: callbackFunc export let sendMessagePool: Record<string, ((sendSuccessMsg: RawMessage) => void) | null> = {} // peerUid: callbackFunc
@ -289,7 +289,7 @@ export class NTQQMsgApi {
}) })
} }
static async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) { static async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) {
const session = wrapperApi.NodeIQQNTWrapperSession const session = getSession()
return await session?.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z); return await session?.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z);
} }
} }

View File

@ -36,7 +36,7 @@ export interface WrapperConstructor {
NodeIKernelProfileListener?: any NodeIKernelProfileListener?: any
} }
export const wrapperApi: WrapperApi = {} const wrapperApi: WrapperApi = {}
export const wrapperConstructor: WrapperConstructor = {} export const wrapperConstructor: WrapperConstructor = {}
@ -76,5 +76,5 @@ Process.dlopen = function (module, filename, flags = os.constants.dlopen.RTLD_LA
} }
export function getSession() { export function getSession() {
return wrapperApi.NodeIQQNTWrapperSession return wrapperApi['NodeIQQNTWrapperSession']
} }