From 2bec9eee0f0932a061e5ad03c7beb76e04e8489c Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 27 Jul 2022 20:27:12 +0300 Subject: [PATCH] bugfix --- src/structure/infractions/Ban.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/structure/infractions/Ban.js b/src/structure/infractions/Ban.js index b658092..f596a47 100644 --- a/src/structure/infractions/Ban.js +++ b/src/structure/infractions/Ban.js @@ -48,7 +48,7 @@ class BanInfraction extends Infraction { const callbacks = this.client.moderationManager.callbacks.filter((c) => c.infraction.type === 'BAN' && c.infraction.target === this.target.id); - if (callbacks.size > 0) callbacks.map((c) => this.client.moderationManager.removeCallback(c.infraction)); + if (callbacks.size > 0) callbacks.map((c) => this.client.moderationManager.removeCallback(c.infraction, true)); return this._succeed(); @@ -56,13 +56,14 @@ class BanInfraction extends Infraction { async verify() { - if (this.target instanceof GuildMember) { - if (!this.member.bannable) return super._fail('C_BAN_CANNOTBEBANNED'); - } + const member = await this.guild.resolveMember(this.target.id); + if (member && !member.bannable) + return super._fail('C_BAN_CANNOTBEBANNED'); + let alreadyBanned = null; try { - alreadyBanned = await this.guild.bans.fetch(this.member.id); + alreadyBanned = await this.guild.bans.fetch(this.target.id); } catch (e) { } //eslint-disable-line no-empty if (alreadyBanned) return super._fail('C_BAN_ALREADYBANNED');