Skip to content

Commit

Permalink
perf: validate len>0 for role check
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Jul 21, 2023
1 parent b3c6283 commit 334f85b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SuggestionBot/Services/CooldownService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public TimeSpan GetRemainingCooldown(DiscordMember member)
}

ulong[] roleIds = member.Roles.Select(r => r.Id).ToArray();
if (configuration.CooldownExemptRoles.Any(roleIds.Contains))
ulong[] exemptRoleIds = configuration.CooldownExemptRoles;

if (roleIds.Length > 0 && exemptRoleIds.Length > 0 && exemptRoleIds.Any(roleIds.Contains))
{
return TimeSpan.Zero;
}
Expand Down

0 comments on commit 334f85b

Please sign in to comment.