fix tempbans

This commit is contained in:
Erik 2022-08-02 16:20:39 +03:00
parent df53af7a4c
commit c072bf18db
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

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