aboutsummaryrefslogtreecommitdiff
path: root/src/tasks/updateCache.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-17 20:03:05 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-17 20:03:05 -0400
commite1c613829950a534d9f45c00a033b83575be3b3c (patch)
tree2de1e5231217211ae4087c46cc74dc46c584507a /src/tasks/updateCache.ts
parent0e87bbd3940d89defcb04926587b35c8f4d1947f (diff)
downloadtanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.gz
tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.bz2
tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.zip
remove global client variable
Diffstat (limited to 'src/tasks/updateCache.ts')
-rw-r--r--src/tasks/updateCache.ts15
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);