From 0a098d5c0c74508436e523d47a6e309236c4281b Mon Sep 17 00:00:00 2001 From: Noikoio Date: Fri, 8 Mar 2019 18:47:43 -0800 Subject: [PATCH] Fix role being mistakenly given in certain situations --- RegexBot/Module/VoiceRoleSync/VoiceRoleSync.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RegexBot/Module/VoiceRoleSync/VoiceRoleSync.cs b/RegexBot/Module/VoiceRoleSync/VoiceRoleSync.cs index b374b6e..99846f7 100644 --- a/RegexBot/Module/VoiceRoleSync/VoiceRoleSync.cs +++ b/RegexBot/Module/VoiceRoleSync/VoiceRoleSync.cs @@ -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