Fix role being mistakenly given in certain situations

This commit is contained in:
Noikoio 2019-03-08 18:47:43 -08:00
parent d6b822ff17
commit 0a098d5c0c

View file

@ -38,7 +38,8 @@ namespace Noikoio.RegexBot.Module.VoiceRoleSync
{
// Replace roles only if the roles to be applied are different.
if (settingBefore != null && user.Roles.Contains(settingBefore)) await user.RemoveRoleAsync(settingBefore);
if (settingAfter != null && !user.Roles.Contains(settingAfter)) await user.AddRoleAsync(settingAfter);
if (settingAfter != null && !user.Roles.Contains(settingAfter) &&
(after.IsDeafened || after.IsSelfDeafened)) await user.AddRoleAsync(settingAfter);
}
}
else