forked from Galactic/galactic-bot
Mutes should now retain removed roles if the mute is overwritten.
This commit is contained in:
parent
90dcbccc99
commit
1cc33adb88
@ -74,10 +74,15 @@ class MuteInfraction extends Infraction {
|
||||
muteRole: role ? role.id : null
|
||||
}; //Info will be saved in database and into the callback when resolved.
|
||||
|
||||
const callbacks = this.client.moderationManager.callbacks.filter((c) => c.infraction.type === 'MUTE'
|
||||
&& c.infraction.target === this.target.id);
|
||||
const callback = this.client.moderationManager.callbacks.filter((c) => c.infraction.type === 'MUTE'
|
||||
&& c.infraction.target === this.target.id).first();
|
||||
|
||||
if(callbacks.size > 0) callbacks.map((c) => this.client.moderationManager._removeExpiration(c));
|
||||
if(callback) {
|
||||
this.data.removedRoles = [...new Set([...this.data.removedRoles, ...callback.infraction.data.removedRoles])];
|
||||
this.client.moderationManager._removeExpiration(callback);
|
||||
}
|
||||
|
||||
// if(callbacks.size > 0) callbacks.map((c) => this.client.moderationManager._removeExpiration(c));
|
||||
|
||||
await this.handle();
|
||||
return this._succeed();
|
||||
|
Loading…
Reference in New Issue
Block a user