diff --git a/src/structure/components/observers/Automoderation.js b/src/structure/components/observers/Automoderation.js index d063db5..8d3b8e5 100644 --- a/src/structure/components/observers/Automoderation.js +++ b/src/structure/components/observers/Automoderation.js @@ -137,7 +137,7 @@ module.exports = class AutoModeration extends Observer { if (!enabled || roles.some((r) => bypass.includes(r)) || ignore.includes(channel.id)) return; - const missing = channel.permissionsFor(this.client.user).missing('ManageMessages'); + const missing = channel.permissionsFor(this.client.user)?.missing('ManageMessages') || []; if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'word', permissions: missing }); return; @@ -440,7 +440,7 @@ module.exports = class AutoModeration extends Observer { if (roles.some((r) => bypass.includes(r)) || ignore.includes(channel.id)) return; - const missing = channel.permissionsFor(this.client.user).missing('ManageMessages'); + const missing = channel.permissionsFor(this.client.user)?.missing('ManageMessages') || []; if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'link', permissions: missing }); return; @@ -567,7 +567,7 @@ module.exports = class AutoModeration extends Observer { if (roles.some((r) => bypass?.includes(r)) || ignore?.includes(channel.id)) return; - const missing = channel.permissionsFor(this.client.user).missing('ManageMessages'); + const missing = channel.permissionsFor(this.client.user)?.missing('ManageMessages') || []; if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'invite', permissions: missing }); return; @@ -626,7 +626,7 @@ module.exports = class AutoModeration extends Observer { if (!enabled || roles.some((r) => bypass.includes(r)) || ignore.includes(channel.id)) return; - const missing = channel.permissionsFor(this.client.user).missing('ManageMessages'); + const missing = channel.permissionsFor(this.client.user)?.missing('ManageMessages') || []; if (missing.length) { this.client.emit('filterMissingPermissions', { channel, guild: wrapper, filter: 'mention', permissions: missing }); return; diff --git a/src/structure/infractions/Mute.js b/src/structure/infractions/Mute.js index fb7e4d5..df187e7 100644 --- a/src/structure/infractions/Mute.js +++ b/src/structure/infractions/Mute.js @@ -110,7 +110,8 @@ class MuteInfraction extends Infraction { && c.infraction.target === this.target.id).first(); if (callback) { - this.data.removedRoles = [...new Set([...this.data.removedRoles, ...callback.infraction.data.removedRoles])]; + if (!this.data.removedRoles) this.data.removedRoles = []; + this.data.removedRoles = [...new Set([...this.data.removedRoles, ...callback.infraction.data.removedRoles||[]])]; this.client.moderationManager.removeCallback(callback.infraction, true); }