Permissions Code altered and fixed for Role usage.

This commit is contained in:
Sean "Solao Bajiuik" Stoves 2020-08-05 17:08:21 -04:00
parent 3349c64f37
commit 5ba1da7d09

View File

@ -45,6 +45,13 @@ namespace ChaosBot.Discord.PreConditions
// If it's a role, check the configuration for the role otherwise return the permission value
requiredGroup = ConfigurationRepository.GetValue<ulong>($"Role:{perm.TargetId}", context.Guild.Id, perm.TargetId);
}
else if (perm.TargetType == (int) PermissionTarget.User)
{
if(context.User.Id == perm.TargetId)
return Task.FromResult(PreconditionResult.FromSuccess());
return Task.FromResult(PreconditionResult.FromError($"You do not have access to this command."));
}
else
{
// Return the permission value