This commit is contained in:
Erik 2021-06-01 00:43:31 +03:00
parent 41ba54bc1d
commit e7533aa189
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

@ -77,21 +77,21 @@ class GuildLogger extends Observer {
const { messageLog } = message.guild._settings;
if(!messageLog.channel) return undefined;
const { ignoredRoles, ignoredChannels } = messageLog;
const { bypass, ignore } = messageLog;
const logChannel = await message.guild.resolveChannel(messageLog.channel);
if(!logChannel) return undefined;
const perms = logChannel.permissionsFor(message.guild.me);
if (!perms.has('SEND_MESSAGES') || !perms.has('VIEW_CHANNEL') || !perms.has('EMBED_LINKS')) return undefined;
if(ignoredRoles.length && message.member.roles.cache.size) {
if(bypass.length && message.member.roles.cache.size) {
const roles = message.member.roles.cache.map((r) => r.id);
for (const role of ignoredRoles) {
for (const role of bypass) {
if (roles.includes(role)) return undefined;
}
}
if (ignoredChannels && ignoredChannels.includes(message.channel.id)) return undefined;
if (ignore && ignore.includes(message.channel.id)) return undefined;
const hook = await message.guild.getWebhook('messageLog');