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' const callbacks = this.client.moderationManager.callbacks.filter((c) => c.infraction.type === 'BAN'
&& c.infraction.target === this.target.id); && 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(); return this._succeed();
@ -56,13 +56,14 @@ class BanInfraction extends Infraction {
async verify() { async verify() {
if (this.target instanceof GuildMember) { const member = await this.guild.resolveMember(this.target.id);
if (!this.member.bannable) return super._fail('C_BAN_CANNOTBEBANNED'); if (member && !member.bannable)
} return super._fail('C_BAN_CANNOTBEBANNED');
let alreadyBanned = null; let alreadyBanned = null;
try { 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 } catch (e) { } //eslint-disable-line no-empty
if (alreadyBanned) return super._fail('C_BAN_ALREADYBANNED'); if (alreadyBanned) return super._fail('C_BAN_ALREADYBANNED');