diff options
Diffstat (limited to 'src/tasks/updateCache.ts')
-rw-r--r-- | src/tasks/updateCache.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index 5babb5e..05c7dc0 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -1,4 +1,6 @@ -import { BushClient, BushTask, Global } from '../lib'; +import { BushClient } from '../lib/extensions/discord-akairo/BushClient'; +import { BushTask } from '../lib/extensions/discord-akairo/BushTask'; +import { Global } from '../lib/models/Global'; import * as config from './../config/options'; export class UpdateCacheTask extends BushTask { @@ -8,16 +10,16 @@ export class UpdateCacheTask extends BushTask { runOnStart: false // done in preinit task }); } - async exec(): Promise<void> { - await this.updateCache(this.client); + public async exec(): Promise<void> { + await UpdateCacheTask.updateCache(this.client); await this.client.logger.verbose(`UpdateCache`, `Updated cache.`); } - async init(client: BushClient): Promise<void> { - await this.updateCache(client); + public static async init(client: BushClient): Promise<void> { + await UpdateCacheTask.updateCache(client); } - async updateCache(client: BushClient): Promise<void> { + private static async updateCache(client: BushClient): Promise<void> { const environment = config.dev ? 'development' : 'production'; const row = (await Global.findByPk(environment)) || @@ -31,7 +33,7 @@ export class UpdateCacheTask extends BushTask { })); for (const option in row) { - if (client.cache[option]) this.client.cache[option] = row[option]; + if (client.cache[option]) client.cache[option] = row[option]; } } } |