Skip to content

Commit

Permalink
Merge pull request #113 from rGunti/hotfix/command-whitelist
Browse files Browse the repository at this point in the history
Command Limitations now accept simple user names instead of User Identifiers
  • Loading branch information
rGunti authored Apr 19, 2023
2 parents 9a7e335 + d5d30c0 commit 72ddb5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public CustomCommandExecutor(
author.AssertLevel(description.Limitations.MinLevel);

if (description.Limitations.LimitedToUsers.Any() &&
!description.Limitations.LimitedToUsers.Contains(author.Identifier.ToString().ToLowerInvariant()))
!description.Limitations.LimitedToUsers.Contains(author.Identifier.ToString().ToLowerInvariant()) &&
!description.Limitations.LimitedToUsers.Contains(author.Identifier.Channel.ToLowerInvariant()))
{
_logger.LogDebug(
"User {UserId} is not whitelisted for command {CommandId} ({CommandName}), command execution skipped",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void HandlesUserLimitationCorrectly(string inputUser, bool expectResult)
Limitations = CommandDescription.Limitations with
{
LimitedToUsers = ImmutableHashSet.Create<string>()
.Add("Mock/CoolUser")
.Add("CoolUser".ToLowerInvariant())
}
})
.ToArray();
Expand Down

0 comments on commit 72ddb5f

Please sign in to comment.