diff options
Diffstat (limited to 'src/tasks/updateCache.ts')
-rw-r--r-- | src/tasks/updateCache.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index 487b9bc..0dc49df 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -1,5 +1,6 @@ import { Time } from '#constants'; import { Global, Guild, Shared, type BushClient } from '#lib'; +import { Client } from 'discord.js'; import config from '../../config/options.js'; import { BushTask } from '../lib/extensions/discord-akairo/BushTask.js'; @@ -13,11 +14,11 @@ export default class UpdateCacheTask extends BushTask { public async exec() { await Promise.all([ - UpdateCacheTask.#updateGlobalCache(client), - UpdateCacheTask.#updateSharedCache(client), - UpdateCacheTask.#updateGuildCache(client) + UpdateCacheTask.#updateGlobalCache(this.client), + UpdateCacheTask.#updateSharedCache(this.client), + UpdateCacheTask.#updateGuildCache(this.client) ]); - void client.logger.verbose(`UpdateCache`, `Updated cache.`); + void this.client.logger.verbose(`UpdateCache`, `Updated cache.`); } public static async init(client: BushClient) { @@ -28,7 +29,7 @@ export default class UpdateCacheTask extends BushTask { ]); } - static async #updateGlobalCache(client: BushClient) { + static async #updateGlobalCache(client: Client) { const environment = config.environment; const row: { [x: string]: any } = ((await Global.findByPk(environment)) ?? (await Global.create({ environment }))).toJSON(); @@ -39,7 +40,7 @@ export default class UpdateCacheTask extends BushTask { } } - static async #updateSharedCache(client: BushClient) { + static async #updateSharedCache(client: Client) { const row: { [x: string]: any } = ((await Shared.findByPk(0)) ?? (await Shared.create())).toJSON(); for (const option in row) { @@ -50,7 +51,7 @@ export default class UpdateCacheTask extends BushTask { } } - static async #updateGuildCache(client: BushClient) { + static async #updateGuildCache(client: Client) { const rows = await Guild.findAll(); for (const row of rows) { client.cache.guilds.set(row.id, row.toJSON() as Guild); |