This commit is contained in:
Erik 2022-09-01 17:00:51 +03:00
parent 487e533089
commit 37d69f315e
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 6 additions and 5 deletions

View File

@ -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;

View File

@ -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);
}