From 25748e932820243547c84033a371331f52943347 Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Sun, 20 Jun 2021 16:58:45 +0200 Subject: [PATCH] fixed try catch on commands --- src/Bot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bot.ts b/src/Bot.ts index 66a4716..ae68e1d 100644 --- a/src/Bot.ts +++ b/src/Bot.ts @@ -73,7 +73,7 @@ class Bot { console.log('Connecting to Discord...'); if(await this.client.login(token)) { console.log('BOT IS READY!\n'); - this.client.on('message', (m) => { + this.client.on('message', async m => { this.on.message(m); const cmdMsg: CommandMessageStructure | null = this.commands.fetch(m, this.config.prefix); if(cmdMsg) { @@ -81,7 +81,7 @@ class Bot { const calledCommand: Command | null = this.commands.get(cmdMsg.name); if(calledCommand) { try { - calledCommand.start(m, cmdMsg.arguments); + await calledCommand.start(m, cmdMsg.arguments); } catch (e) { console.error(`ERROR! ${e.toString()}`);