From 777bbd0170bdd268d56e8c2e36d2fd668025ac2c Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 28 Mar 2022 01:42:11 +0300 Subject: [PATCH] error log --- .../components/observers/ErrorLog.js | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/structure/components/observers/ErrorLog.js b/src/structure/components/observers/ErrorLog.js index ca605e9..b6db158 100644 --- a/src/structure/components/observers/ErrorLog.js +++ b/src/structure/components/observers/ErrorLog.js @@ -15,7 +15,8 @@ class ErrorLog extends Observer { }); this.hooks = [ - ['automodError', this.automod.bind(this)] + ['automodError', this.automod.bind(this)], + ['wordWatcherError', this.wordWatcher.bind(this)] ]; } @@ -37,7 +38,7 @@ class ErrorLog extends Observer { infractionReason: infraction.reason, reason: guild.format(`${reason}_AUTOMOD`) })}`; - + await channel.send({ embeds: [{ description: str, @@ -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; \ No newline at end of file