refa: deps

This commit is contained in:
idranme
2024-08-02 12:00:13 +00:00
parent d0967785de
commit f3af0d18bc
8 changed files with 30 additions and 35 deletions

View File

@@ -13,7 +13,6 @@ import {
uidMaps,
} from '@/common/data'
import { OB11GroupDecreaseEvent } from '../onebot11/event/notice/OB11GroupDecreaseEvent'
import { v4 as uuidv4 } from 'uuid'
import { postOb11Event } from '../onebot11/server/post-ob11-event'
import { getConfigUtil, HOOK_LOG } from '@/common/config'
import fs from 'fs'
@@ -23,6 +22,7 @@ import { log } from '@/common/utils'
import { isNumeric, sleep } from '@/common/utils'
import { OB11Constructor } from '../onebot11/constructor'
import { OB11GroupCardEvent } from '../onebot11/event/notice/OB11GroupCardEvent'
import { randomUUID } from 'node:crypto'
export let hookApiCallbacks: Record<string, (apiReturn: any) => void> = {}
@@ -203,7 +203,7 @@ export function registerReceiveHook<PayloadType>(
method: ReceiveCmd | ReceiveCmd[],
hookFunc: (payload: PayloadType) => void,
): string {
const id = uuidv4()
const id = randomUUID()
if (!Array.isArray(method)) {
method = [method]
}

View File

@@ -1,10 +1,9 @@
import { ipcMain } from 'electron'
import { hookApiCallbacks, ReceiveCmd, ReceiveCmdS, registerReceiveHook, removeReceiveHook } from './hook'
import { v4 as uuidv4 } from 'uuid'
import { log } from '../common/utils/log'
import { NTQQWindow, NTQQWindowApi, NTQQWindows } from './api/window'
import { HOOK_LOG } from '../common/config'
import { randomUUID } from 'node:crypto'
export enum NTQQApiClass {
NT_API = 'ns-ntApi',
@@ -130,7 +129,7 @@ export function callNTQQApi<ReturnType>(params: NTQQApiParams) {
args = args ?? []
timeout = timeout ?? 5
afterFirstCmd = afterFirstCmd ?? true
const uuid = uuidv4()
const uuid = randomUUID()
HOOK_LOG && log('callNTQQApi', channel, className, methodName, args, uuid)
return new Promise((resolve: (data: ReturnType) => void, reject) => {
// log("callNTQQApiPromise", channel, className, methodName, args, uuid)