diff options
Diffstat (limited to 'src/tasks/updateCache.ts')
-rw-r--r-- | src/tasks/updateCache.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index 7fb7eb3..69919d8 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -24,11 +24,13 @@ export class UpdateCacheTask extends BushTask { private static async updateGlobalCache(client: BushClient): Promise<void> { const environment = config.environment; - const row = ((await Global.findByPk(environment)) ?? (await Global.create({ environment }))).toJSON(); + const row: { [x: string]: any } = ((await Global.findByPk(environment)) ?? (await Global.create({ environment }))).toJSON(); for (const option in row) { - if (Object.keys(client.cache.global).includes(option)) - client.cache.global[option as keyof typeof client.cache.global] = row[option as keyof typeof row]; + if (Object.keys(client.cache.global).includes(option)) { + client.cache.global[option as keyof typeof client.cache.global] = row[option]; + if (option === 'superUsers') client.superUserID = row[option]; + } } } |