mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 06:10:22 +00:00
fix: remove possiblity of duplicated instance of DataLoader (#688)
This commit is contained in:
parent
9aaf66018f
commit
843e4137cb
2
types/global.d.ts
vendored
2
types/global.d.ts
vendored
@ -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
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user