This commit is contained in:
Erik 2022-07-08 22:00:08 +03:00
parent df547e2ba5
commit 0c0d65ee24
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 10 additions and 5 deletions

View File

@ -72,8 +72,8 @@ class BanInfraction extends Infraction {
} }
async resolve(...args) { async resolve(...args) {
const member = await this.guild.memberWrapper(this.targetId); const infraction = await this.client.moderationManager.findLatestInfraction(this.type, this.targetId);
const callback = await member.getCallback(this.type); const callback = this.client.moderationManager.callbacks.get(infraction.id);
if (callback) this.client.moderationManager.removeCallback(callback); if (callback) this.client.moderationManager.removeCallback(callback);
const banned = await this.guild.bans.fetch(this.targetId).catch(() => null); const banned = await this.guild.bans.fetch(this.targetId).catch(() => null);

View File

@ -58,14 +58,19 @@ class UtilityHook extends Observer {
guild: guild.id, guild: guild.id,
target: member.id, target: member.id,
type: 'MUTE', type: 'MUTE',
_callbacked: false _callbacked: false,
resolved: false
}); });
if (!infraction || infraction.resolved) return; if (!infraction || infraction.resolved) return;
const role = await guild.resolveRole(setting.role);
if (infraction.data.muteType === 0) await member.roles.add(setting.role, 'automute upon rejoin, type 0'); if (infraction.data.muteType === 0) {
else if (infraction.data.muteType === 1) { if (!role) return;
await member.roles.add(setting.role, 'automute upon rejoin, type 0');
} else if (infraction.data.muteType === 1) {
if (!role) return;
await Util.wait(5 * 1000); //wait 5 seconds in case other bots add roles that would break the mute await Util.wait(5 * 1000); //wait 5 seconds in case other bots add roles that would break the mute
const roles = member.roles.cache; const roles = member.roles.cache;
const managed = roles.find((r) => r.managed); const managed = roles.find((r) => r.managed);