Fixed error reporting
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
86cabb74dc
commit
c61cf5a12e
1 changed files with 7 additions and 7 deletions
|
@ -11,17 +11,17 @@ class errorListener extends Listener {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message, error, command) {
|
async exec(error, message, command) {
|
||||||
console.log(message);
|
console.error(`Error happenend on the command: ${command.id}\n${error}\nOn the message: ${message}`);
|
||||||
console.error(`Error happenend on the command: ${command.id}\n${message}\nOn the message: ${error}`);
|
|
||||||
const channel = this.client.channels.resolve(errorChannel);
|
const channel = this.client.channels.resolve(errorChannel);
|
||||||
const errorEmbed = this.client.util.embed()
|
const errorEmbed = this.client.util.embed()
|
||||||
.setColor('RED')
|
.setColor('RED')
|
||||||
.setTitle('Shit happened!')
|
.setTitle('Shit happened!')
|
||||||
.addField('Command', command.id, true)
|
.addField('Command', command.id, true)
|
||||||
.addField('Error', message, true)
|
.addField('Error', error, true)
|
||||||
.addField('Message', error, true)
|
.addField('Message', message, true);
|
||||||
.addField('Author', `${message.author.tag} (${message.author.id})`);
|
|
||||||
|
if (message.author) errorEmbed.addField('Author', `${message.author.tag} (${message.author.id})`);
|
||||||
|
|
||||||
channel.send(errorEmbed);
|
channel.send(errorEmbed);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class errorListener extends Listener {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
//Create txt with the current time
|
//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) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue