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]
|
[WORDWATCHER_MISSING_MEMBER]
|
||||||
Missing target member for action **{actionType}**.
|
Missing target member for action **{actionType}**.
|
||||||
|
|
||||||
|
[LINKFILTER_WARN_TITLE]
|
||||||
|
{emoji_warning} __**Linkfilter Warning**__
|
||||||
|
|
||||||
[LINKFILTER_WARN]
|
[LINKFILTER_WARN]
|
||||||
Failed to validate domain `{domain}`.
|
Failed to validate domain `{domain}`.
|
||||||
If this is a valid domain, add it to the greylist to ensure it is filtered.
|
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)],
|
['automodError', this.automod.bind(this)],
|
||||||
['wordWatcherError', this.wordWatcher.bind(this)],
|
['wordWatcherError', this.wordWatcher.bind(this)],
|
||||||
['logError', this.logError.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 }) {
|
async automod({ fatal, reason, infraction }) {
|
||||||
|
|
||||||
const { guild, target, type } = infraction;
|
const { guild, target, type } = infraction;
|
||||||
const settings = await guild.settings();
|
// const settings = await guild.settings();
|
||||||
const { errors } = settings;
|
// const { errors } = settings;
|
||||||
const { channel: _channel, types } = errors;
|
// const { channel: _channel, types } = errors;
|
||||||
if (!_channel) return;
|
// if (!_channel) return;
|
||||||
|
|
||||||
const channel = await guild.resolveChannel(_channel);
|
// const channel = await guild.resolveChannel(_channel);
|
||||||
if (!channel) return;
|
// if (!channel) return;
|
||||||
|
|
||||||
const str = `${guild.format('AUTOMOD_ERROR', {
|
const str = `${guild.format('AUTOMOD_ERROR', {
|
||||||
channel: infraction.channel.id,
|
channel: infraction.channel.id,
|
||||||
@ -63,45 +64,57 @@ class ErrorLog extends Observer {
|
|||||||
infractionReason: infraction.reason,
|
infractionReason: infraction.reason,
|
||||||
reason: guild.format(`${reason}_AUTOMOD`)
|
reason: guild.format(`${reason}_AUTOMOD`)
|
||||||
})}`;
|
})}`;
|
||||||
|
const embed = {
|
||||||
|
description: str,
|
||||||
|
color: COLOURS[fatal ? 'fatal' : 'warning']
|
||||||
|
};
|
||||||
|
|
||||||
this.client.rateLimiter.limitSend(channel, {
|
// this.client.rateLimiter.limitSend(channel, {
|
||||||
embeds: [{
|
// embeds: [{
|
||||||
description: str,
|
// description: str,
|
||||||
color: COLOURS[fatal ? 'fatal' : 'warning']
|
// color: COLOURS[fatal ? 'fatal' : 'warning']
|
||||||
}]
|
// }]
|
||||||
}, null, 'automodError');
|
// }, null, 'automodError');
|
||||||
|
|
||||||
|
this.post(guild, embed, 'automodError');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async wordWatcher({ message, guild, warning }) {
|
async wordWatcher({ message, guild, warning }) {
|
||||||
|
|
||||||
const settings = await guild.settings();
|
// const settings = await guild.settings();
|
||||||
const { errors } = settings;
|
// const { errors } = settings;
|
||||||
const { channel: _channel, types } = errors;
|
// const { channel: _channel, types } = errors;
|
||||||
if (!_channel) return;
|
// if (!_channel) return;
|
||||||
|
|
||||||
const channel = await guild.resolveChannel(_channel);
|
// const channel = await guild.resolveChannel(_channel);
|
||||||
if (!channel) return;
|
// if (!channel) return;
|
||||||
|
|
||||||
const str = `${guild.format(`WORDWATCHER_${warning ? 'WARN' : 'ERROR'}`)}\n${message}`;
|
const str = `${guild.format(`WORDWATCHER_${warning ? 'WARN' : 'ERROR'}`)}\n${message}`;
|
||||||
|
const embed = {
|
||||||
|
description: str,
|
||||||
|
color: COLOURS[warning ? 'warning' : 'fatal']
|
||||||
|
};
|
||||||
|
|
||||||
this.client.rateLimiter.limitSend(channel, {
|
// this.client.rateLimiter.limitSend(channel, {
|
||||||
embeds: [{
|
// embeds: [{
|
||||||
description: str,
|
// description: str,
|
||||||
color: COLOURS[warning ? 'warning' : 'fatal']
|
// color: COLOURS[warning ? 'warning' : 'fatal']
|
||||||
}]
|
// }]
|
||||||
}, null, 'wordWatcherError');
|
// }, null, 'wordWatcherError');
|
||||||
|
|
||||||
|
this.post(guild, embed, 'wordWatcherError');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async utilityError({ guild, utility, reason, params }) {
|
async utilityError({ guild, utility, reason, params }) {
|
||||||
const settings = await guild.settings();
|
// const settings = await guild.settings();
|
||||||
const { errors } = settings;
|
// const { errors } = settings;
|
||||||
const { channel: _channel, types } = errors;
|
// const { channel: _channel, types } = errors;
|
||||||
if (!_channel) return;
|
// if (!_channel) return;
|
||||||
|
|
||||||
const channel = await guild.resolveChannel(_channel);
|
// const channel = await guild.resolveChannel(_channel);
|
||||||
if (!channel) return;
|
// if (!channel) return;
|
||||||
|
|
||||||
const embed = {
|
const embed = {
|
||||||
description: guild.format(`UTILITY_ERROR`, {
|
description: guild.format(`UTILITY_ERROR`, {
|
||||||
@ -111,7 +124,27 @@ class ErrorLog extends Observer {
|
|||||||
color: COLOURS.warning
|
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