diff --git a/types/global.d.ts b/types/global.d.ts index 12ececf..3b9ba99 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -2,6 +2,7 @@ import * as Yup from 'yup' import { Client } from 'discord.js' import NotificationManager from '@utils/NotificationManager' +import { CacheManager } from '@utils/Query' declare global { interface Window { @@ -14,6 +15,7 @@ declare global { var kodl: Client var serverlist: Client var notification: NotificationManager + var get: CacheManager interface Navigator { standalone?: boolean } diff --git a/utils/Query.ts b/utils/Query.ts index 6a4eb4f..07a49cc 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -1199,7 +1199,7 @@ async function viewBot(id: string) { await Bots.findByIdAndUpdate(id, { $push: { viewMetrix: { count: 0 } } }, { upsert: true }) } -export const get = { +const _get = { discord: { user: new DataLoader( async (ids: string[]) => @@ -1414,6 +1414,14 @@ export const get = { }, } +export type CacheManager = typeof _get + +if (!global.get) { + global.get = _get +} + +export const get = global.get + export const update = { assignToken, resetBotToken,