error log

This commit is contained in:
Erik 2022-03-28 01:42:11 +03:00
parent 5c80bbe715
commit 777bbd0170
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -15,7 +15,8 @@ class ErrorLog extends Observer {
}); });
this.hooks = [ this.hooks = [
['automodError', this.automod.bind(this)] ['automodError', this.automod.bind(this)],
['wordWatcherError', this.wordWatcher.bind(this)]
]; ];
} }
@ -47,6 +48,26 @@ class ErrorLog extends Observer {
} }
async wordWatcher({ message, guild, warning }) {
const settings = await guild.settings();
const { errors } = settings;
const { channel: _channel, types } = errors;
if (!_channel) return;
const channel = await guild.resolveChannel(_channel);
const str = `${guild.format(`WORDWATCHER_${warning ? 'WARN' : 'ERROR'}`)}\n${message}`;
await channel.send({
embeds: [{
description: str,
color: COLOURS[warning ? 'warning' : 'fatal']
}]
});
}
} }
module.exports = ErrorLog; module.exports = ErrorLog;