forked from Galactic/galactic-bot
bugfix
This commit is contained in:
parent
df547e2ba5
commit
0c0d65ee24
@ -72,8 +72,8 @@ class BanInfraction extends Infraction {
|
||||
}
|
||||
|
||||
async resolve(...args) {
|
||||
const member = await this.guild.memberWrapper(this.targetId);
|
||||
const callback = await member.getCallback(this.type);
|
||||
const infraction = await this.client.moderationManager.findLatestInfraction(this.type, this.targetId);
|
||||
const callback = this.client.moderationManager.callbacks.get(infraction.id);
|
||||
if (callback) this.client.moderationManager.removeCallback(callback);
|
||||
|
||||
const banned = await this.guild.bans.fetch(this.targetId).catch(() => null);
|
||||
|
@ -58,14 +58,19 @@ class UtilityHook extends Observer {
|
||||
guild: guild.id,
|
||||
target: member.id,
|
||||
type: 'MUTE',
|
||||
_callbacked: false
|
||||
_callbacked: false,
|
||||
resolved: false
|
||||
});
|
||||
|
||||
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');
|
||||
else if (infraction.data.muteType === 1) {
|
||||
if (infraction.data.muteType === 0) {
|
||||
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
|
||||
const roles = member.roles.cache;
|
||||
const managed = roles.find((r) => r.managed);
|
||||
|
Loading…
Reference in New Issue
Block a user