diff options
Diffstat (limited to 'src/tasks')
-rw-r--r-- | src/tasks/unban.ts | 2 | ||||
-rw-r--r-- | src/tasks/unmute.ts | 2 | ||||
-rw-r--r-- | src/tasks/updateCache.ts | 16 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/tasks/unban.ts b/src/tasks/unban.ts index 3d39b02..f5d6b53 100644 --- a/src/tasks/unban.ts +++ b/src/tasks/unban.ts @@ -1,6 +1,6 @@ +import { Ban, BushTask } from '@lib'; import { DiscordAPIError } from 'discord.js'; import { Op } from 'sequelize'; -import { Ban, BushTask } from '../lib'; export default class UnbanTask extends BushTask { public constructor() { diff --git a/src/tasks/unmute.ts b/src/tasks/unmute.ts index 379fca4..7a04360 100644 --- a/src/tasks/unmute.ts +++ b/src/tasks/unmute.ts @@ -1,6 +1,6 @@ +import { BushTask, Guild, Mute } from '@lib'; import { DiscordAPIError } from 'discord.js'; import { Op } from 'sequelize'; -import { BushTask, Guild, Mute } from '../lib'; export default class UnmuteTask extends BushTask { public constructor() { 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]; } } } |