From c61cf5a12e80e81c0d38b6e2c8fa15e2e94086cc Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 11 May 2020 18:45:42 +0200 Subject: [PATCH] Fixed error reporting Signed-off-by: loicbersier --- event/listeners/error.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/event/listeners/error.js b/event/listeners/error.js index 414290e..7c5f31a 100644 --- a/event/listeners/error.js +++ b/event/listeners/error.js @@ -11,17 +11,17 @@ class errorListener extends Listener { }); } - async exec(message, error, command) { - console.log(message); - console.error(`Error happenend on the command: ${command.id}\n${message}\nOn the message: ${error}`); + async exec(error, message, command) { + console.error(`Error happenend on the command: ${command.id}\n${error}\nOn the message: ${message}`); const channel = this.client.channels.resolve(errorChannel); const errorEmbed = this.client.util.embed() .setColor('RED') .setTitle('Shit happened!') .addField('Command', command.id, true) - .addField('Error', message, true) - .addField('Message', error, true) - .addField('Author', `${message.author.tag} (${message.author.id})`); + .addField('Error', error, true) + .addField('Message', message, true); + + if (message.author) errorEmbed.addField('Author', `${message.author.tag} (${message.author.id})`); channel.send(errorEmbed); @@ -47,7 +47,7 @@ class errorListener extends Listener { console.error(err); } //Create txt with the current time - fs.writeFile(`./error/${today}/${currentTime}.txt`, `Error happenend on the command: ${command.id}\n${message}\nOn the message: ${error}`, function (err) { + fs.writeFile(`./error/${today}/${currentTime}.txt`, `Error happenend on the command: ${command.id}\n${error}\nOn the message: ${message}`, function (err) { if (err) { console.error(err); }