From 2c8dc89a42b7c9988533f686800fb947dd66ad60 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 26 Oct 2019 13:06:54 -0400 Subject: [PATCH] use util binded to client on messageCreate --- src/events/messageCreate.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 1e86ba1..5d225e6 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -1,23 +1,21 @@ import { Message, TextChannel } from 'eris'; -import { Client, config, Util } from '..'; +import { Client, config } from '..'; import Command from '../class/Command'; const { prefix } = config; export default class { - client: Client + public client: Client constructor(client: Client) { this.client = client; } - util: Util = new Util(this.client) - - async run(message: Message) { + public async run(message: Message) { try { const noPrefix: string[] = message.content.slice(prefix.length).trim().split(/ +/g); const command: string = noPrefix[0].toLowerCase(); - const resolved: Command = this.util.resolveCommand(command); + const resolved: Command = this.client.util.resolveCommand(command); if (!resolved) return; if (resolved.guildOnly && !(message.channel instanceof TextChannel)) return; const hasUserPerms: boolean = resolved.permissions.users.includes(message.author.id); @@ -32,7 +30,7 @@ export default class { const args: string[] = noPrefix.slice(1); resolved.run(message, args); } catch (error) { - this.util.handleError(error, message); + this.client.util.handleError(error, message); } } }