forked from Galactic/galactic-bot
error logs
This commit is contained in:
parent
281d20b867
commit
9aa902ed6f
@ -39,6 +39,9 @@ The channel in which the message was no longer exists.
|
||||
[WORDWATCHER_MISSING_MEMBER]
|
||||
Missing target member for action **{actionType}**.
|
||||
|
||||
[LINKFILTER_WARN_TITLE]
|
||||
{emoji_warning} __**Linkfilter Warning**__
|
||||
|
||||
[LINKFILTER_WARN]
|
||||
Failed to validate domain `{domain}`.
|
||||
If this is a valid domain, add it to the greylist to ensure it is filtered.
|
@ -18,7 +18,8 @@ class ErrorLog extends Observer {
|
||||
['automodError', this.automod.bind(this)],
|
||||
['wordWatcherError', this.wordWatcher.bind(this)],
|
||||
['logError', this.logError.bind(this)],
|
||||
['utilityError', this.utilityError.bind(this)]
|
||||
['utilityError', this.utilityError.bind(this)],
|
||||
['linkFilterWarn', this.linkFilterWarn.bind(this)]
|
||||
];
|
||||
|
||||
}
|
||||
@ -48,13 +49,13 @@ class ErrorLog extends Observer {
|
||||
async automod({ fatal, reason, infraction }) {
|
||||
|
||||
const { guild, target, type } = infraction;
|
||||
const settings = await guild.settings();
|
||||
const { errors } = settings;
|
||||
const { channel: _channel, types } = errors;
|
||||
if (!_channel) return;
|
||||
// const settings = await guild.settings();
|
||||
// const { errors } = settings;
|
||||
// const { channel: _channel, types } = errors;
|
||||
// if (!_channel) return;
|
||||
|
||||
const channel = await guild.resolveChannel(_channel);
|
||||
if (!channel) return;
|
||||
// const channel = await guild.resolveChannel(_channel);
|
||||
// if (!channel) return;
|
||||
|
||||
const str = `${guild.format('AUTOMOD_ERROR', {
|
||||
channel: infraction.channel.id,
|
||||
@ -63,45 +64,57 @@ class ErrorLog extends Observer {
|
||||
infractionReason: infraction.reason,
|
||||
reason: guild.format(`${reason}_AUTOMOD`)
|
||||
})}`;
|
||||
const embed = {
|
||||
description: str,
|
||||
color: COLOURS[fatal ? 'fatal' : 'warning']
|
||||
};
|
||||
|
||||
this.client.rateLimiter.limitSend(channel, {
|
||||
embeds: [{
|
||||
description: str,
|
||||
color: COLOURS[fatal ? 'fatal' : 'warning']
|
||||
}]
|
||||
}, null, 'automodError');
|
||||
// this.client.rateLimiter.limitSend(channel, {
|
||||
// embeds: [{
|
||||
// description: str,
|
||||
// color: COLOURS[fatal ? 'fatal' : 'warning']
|
||||
// }]
|
||||
// }, null, 'automodError');
|
||||
|
||||
this.post(guild, embed, 'automodError');
|
||||
|
||||
}
|
||||
|
||||
async wordWatcher({ message, guild, warning }) {
|
||||
|
||||
const settings = await guild.settings();
|
||||
const { errors } = settings;
|
||||
const { channel: _channel, types } = errors;
|
||||
if (!_channel) return;
|
||||
// const settings = await guild.settings();
|
||||
// const { errors } = settings;
|
||||
// const { channel: _channel, types } = errors;
|
||||
// if (!_channel) return;
|
||||
|
||||
const channel = await guild.resolveChannel(_channel);
|
||||
if (!channel) return;
|
||||
// const channel = await guild.resolveChannel(_channel);
|
||||
// if (!channel) return;
|
||||
|
||||
const str = `${guild.format(`WORDWATCHER_${warning ? 'WARN' : 'ERROR'}`)}\n${message}`;
|
||||
const embed = {
|
||||
description: str,
|
||||
color: COLOURS[warning ? 'warning' : 'fatal']
|
||||
};
|
||||
|
||||
this.client.rateLimiter.limitSend(channel, {
|
||||
embeds: [{
|
||||
description: str,
|
||||
color: COLOURS[warning ? 'warning' : 'fatal']
|
||||
}]
|
||||
}, null, 'wordWatcherError');
|
||||
// this.client.rateLimiter.limitSend(channel, {
|
||||
// embeds: [{
|
||||
// description: str,
|
||||
// color: COLOURS[warning ? 'warning' : 'fatal']
|
||||
// }]
|
||||
// }, null, 'wordWatcherError');
|
||||
|
||||
this.post(guild, embed, 'wordWatcherError');
|
||||
|
||||
}
|
||||
|
||||
async utilityError({ guild, utility, reason, params }) {
|
||||
const settings = await guild.settings();
|
||||
const { errors } = settings;
|
||||
const { channel: _channel, types } = errors;
|
||||
if (!_channel) return;
|
||||
// const settings = await guild.settings();
|
||||
// const { errors } = settings;
|
||||
// const { channel: _channel, types } = errors;
|
||||
// if (!_channel) return;
|
||||
|
||||
const channel = await guild.resolveChannel(_channel);
|
||||
if (!channel) return;
|
||||
// const channel = await guild.resolveChannel(_channel);
|
||||
// if (!channel) return;
|
||||
|
||||
const embed = {
|
||||
description: guild.format(`UTILITY_ERROR`, {
|
||||
@ -111,7 +124,27 @@ class ErrorLog extends Observer {
|
||||
color: COLOURS.warning
|
||||
};
|
||||
|
||||
this.client.rateLimiter.limitSend(channel, { embeds: [embed] }, null, 'utilityError');
|
||||
// this.client.rateLimiter.limitSend(channel, { embeds: [embed] }, null, 'utilityError');
|
||||
this.post(guild, embed, 'utilityError');
|
||||
}
|
||||
|
||||
linkFilterWarn({ guild, message }) {
|
||||
const embed = {
|
||||
description: `${guild.format('LINKFILTER_WARN_TITLE')}\n\n${message}`,
|
||||
color: COLOURS.warning
|
||||
};
|
||||
this.post(guild, embed, 'linkFilterWarn');
|
||||
}
|
||||
|
||||
async post(guild, embed, type) {
|
||||
const settings = await guild.settings();
|
||||
const { errors } = settings;
|
||||
const { channel: _channel, types } = errors;
|
||||
if (!_channel) return;
|
||||
|
||||
const channel = await guild.resolveChannel(_channel);
|
||||
if (!channel) return;
|
||||
this.client.rateLimiter.limitSend(channel, { embeds: [embed] }, null, type);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user