From f94566edbf8df71c966741c58ffa3ae68e468c12 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sat, 9 Jul 2022 11:09:29 +0300 Subject: [PATCH] fix for no dms when removed from server --- src/structure/components/infractions/Ban.js | 6 +++--- src/structure/components/infractions/Kick.js | 3 ++- src/structure/components/infractions/Softban.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/structure/components/infractions/Ban.js b/src/structure/components/infractions/Ban.js index dfa9875..74211ea 100644 --- a/src/structure/components/infractions/Ban.js +++ b/src/structure/components/infractions/Ban.js @@ -34,6 +34,7 @@ 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; + await this.handle(); try { await this.guild.members.ban(this.target.id, { @@ -49,7 +50,6 @@ class BanInfraction extends Infraction { if (callbacks.size > 0) callbacks.map((c) => this.client.moderationManager.removeCallback(c)); - await this.handle(); return this._succeed(); } @@ -72,8 +72,8 @@ class BanInfraction extends Infraction { } async resolve(...args) { - const infraction = await this.client.moderationManager.findLatestInfraction(this.type, this.targetId); - const callback = this.client.moderationManager.callbacks.get(infraction.id); + // const infraction = await this.client.moderationManager.findLatestInfraction(this.type, this.targetId); + const callback = this.client.moderationManager.callbacks.get(this.id); if (callback) this.client.moderationManager.removeCallback(callback); const banned = await this.guild.bans.fetch(this.targetId).catch(() => null); diff --git a/src/structure/components/infractions/Kick.js b/src/structure/components/infractions/Kick.js index 29f772b..12c3959 100644 --- a/src/structure/components/infractions/Kick.js +++ b/src/structure/components/infractions/Kick.js @@ -34,13 +34,14 @@ class KickInfraction extends Infraction { async execute() { + await this.handle(); + try { await this.member.kick(this._reason); } catch (error) { return this._fail('INFRACTION_ERROR'); } - await this.handle(); return this._succeed(); } diff --git a/src/structure/components/infractions/Softban.js b/src/structure/components/infractions/Softban.js index 5f97c3d..1f45406 100644 --- a/src/structure/components/infractions/Softban.js +++ b/src/structure/components/infractions/Softban.js @@ -31,6 +31,7 @@ class SoftbanInfraction extends Infraction { let days = 1; if (this.arguments.days) days = this.arguments.days.value; + await this.handle(); try { await this.guild.members.ban(this.target.id, { @@ -42,7 +43,6 @@ class SoftbanInfraction extends Infraction { return this._fail('INFRACTION_ERROR'); } - await this.handle(); return this._succeed(); }