fix for no dms when removed from server

This commit is contained in:
Erik 2022-07-09 11:09:29 +03:00
parent 5b4efc566f
commit f94566edbf
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 6 additions and 5 deletions

View File

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

View File

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

View File

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