From 66b958cd1d38a8ba0d64ecd188bc8d90e850cfbb Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 11 Jul 2021 20:52:56 -0400 Subject: fix: circular imports --- src/tasks/unban.ts | 2 +- src/tasks/unmute.ts | 2 +- src/tasks/updateCache.ts | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/tasks') 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 { - await this.updateCache(this.client); + public async exec(): Promise { + await UpdateCacheTask.updateCache(this.client); await this.client.logger.verbose(`UpdateCache`, `Updated cache.`); } - async init(client: BushClient): Promise { - await this.updateCache(client); + public static async init(client: BushClient): Promise { + await UpdateCacheTask.updateCache(client); } - async updateCache(client: BushClient): Promise { + private static async updateCache(client: BushClient): Promise { 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]; } } } -- cgit