bugfix & perm check

This commit is contained in:
Erik 2022-07-24 00:46:29 +03:00
parent 783abcee62
commit 08ea03ccbf
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -28,13 +28,13 @@ class ErrorLog extends Observer {
async logError({ guild, reason, logger, params }) { async logError({ guild, reason, logger, 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(`LOGGING_ERROR`, { description: guild.format(`LOGGING_ERROR`, {
@ -44,7 +44,8 @@ class ErrorLog extends Observer {
color: COLOURS.warning color: COLOURS.warning
}; };
this.client.rateLimiter.limitSend(channel, { embeds: [embed] }, null, 'logError'); //this.client.rateLimiter.limitSend(channel, { embeds: [embed] }, null, 'logError');
this.post(guild, embed, 'logError');
} }
@ -156,7 +157,7 @@ class ErrorLog extends Observer {
if (!_channel) return; if (!_channel) return;
const channel = await guild.resolveChannel(_channel); const channel = await guild.resolveChannel(_channel);
if (!channel) return; if (!channel || channel.permissionsFor(guild.me).missing('SendMessages', 'EmbedLinks')) return;
this.client.rateLimiter.limitSend(channel, { embeds: [embed] }, null, type); this.client.rateLimiter.limitSend(channel, { embeds: [embed] }, null, type);
} }