From 5ba1da7d096973f0c17fde18ebc50b27ef8360a9 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Wed, 5 Aug 2020 17:08:21 -0400 Subject: [PATCH] Permissions Code altered and fixed for Role usage. --- ChaosBot/Discord/PreConditions/CheckCommandPerm.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChaosBot/Discord/PreConditions/CheckCommandPerm.cs b/ChaosBot/Discord/PreConditions/CheckCommandPerm.cs index f7a3f32..2013651 100644 --- a/ChaosBot/Discord/PreConditions/CheckCommandPerm.cs +++ b/ChaosBot/Discord/PreConditions/CheckCommandPerm.cs @@ -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($"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