This commit is contained in:
Erik 2022-07-27 20:27:12 +03:00
parent a938539993
commit 2bec9eee0f
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

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