From ba27e52e0cb319e15cd2cc61b40f590553ee2a8f Mon Sep 17 00:00:00 2001 From: Matthew R Date: Thu, 17 Oct 2019 15:43:32 -0400 Subject: [PATCH] Util class is binded to client, no need to make another class for each command --- src/commands/lock.ts | 5 +---- src/commands/modlogs.ts | 1 + src/commands/ping.ts | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/commands/lock.ts b/src/commands/lock.ts index 051118a..da8ebc8 100644 --- a/src/commands/lock.ts +++ b/src/commands/lock.ts @@ -2,11 +2,8 @@ import fs from 'fs-extra'; import { Message } from 'eris'; import Client from '../Client'; import Command from '../class/Command'; -import Util from '../Util'; export default class Lock extends Command { - util: Util = new Util(this.client) - constructor(client: Client) { super(client); this.name = 'lock'; @@ -21,7 +18,7 @@ export default class Lock extends Command { if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`); const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`); } catch (error) { - return this.util.handleError(error, message, this); + return this.client.util.handleError(error, message, this); } } } diff --git a/src/commands/modlogs.ts b/src/commands/modlogs.ts index af96f6f..6a7288c 100644 --- a/src/commands/modlogs.ts +++ b/src/commands/modlogs.ts @@ -1,4 +1,5 @@ import { Message } from 'eris'; +// eslint-disable-next-line import/no-unresolved import { createPaginationEmbed } from 'eris-pagination'; import Client from '../Client'; import Command from '../class/Command'; diff --git a/src/commands/ping.ts b/src/commands/ping.ts index c6c1681..00db1bc 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -1,11 +1,8 @@ import { Message } from 'eris'; import Client from '../Client'; import Command from '../class/Command'; -import Util from '../Util'; export default class Ping extends Command { - util: Util = new Util(this.client) - constructor(client: Client) { super(client); this.name = 'ping'; @@ -19,7 +16,7 @@ export default class Ping extends Command { const msg: Message = await message.channel.createMessage('🏓 Pong!'); msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``); } catch (error) { - this.util.handleError(error, message, this); + this.client.util.handleError(error, message, this); } } }