Send error to error channel

This commit is contained in:
loicbersier 2020-02-18 19:48:11 +01:00
parent 6fd70083ba
commit c0985b22c4

View file

@ -1,6 +1,7 @@
const { Listener } = require('discord-akairo');
const mkdirp = require('mkdirp');
const fs = require('fs');
const { errorChannel } = require('../../config.json');
class errorListener extends Listener {
constructor() {
@ -11,7 +12,16 @@ 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}`);
const channel = this.client.channels.get(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);
channel.send(errorEmbed);
//Get current date
let today = new Date();
let dd = today.getDate();