From c072bf18db728bd101f7bd894eb4cdeceef99806 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 2 Aug 2022 16:20:39 +0300 Subject: [PATCH] fix tempbans --- 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 f596a47..161bc18 100644 --- a/src/structure/infractions/Ban.js +++ b/src/structure/infractions/Ban.js @@ -34,6 +34,12 @@ class BanInfraction extends Infraction { let days = 0; if (this.message && this.message._caller === 'hardban') days = 1; if (this.arguments.days) days = this.arguments.days.value; + + 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, true)); + await this.handle(); try { @@ -45,11 +51,6 @@ class BanInfraction extends Infraction { return this._fail('INFRACTION_ERROR'); } - 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, true)); - return this._succeed(); }