From ddce0a95040376c03be8622e50cdda70b0ebd0e7 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Mon, 15 Jun 2020 22:09:44 -0400 Subject: [PATCH] Set Server Owner to have permission for all commands. --- ChaosBot/Discord/PreConditions/RequireRole.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChaosBot/Discord/PreConditions/RequireRole.cs b/ChaosBot/Discord/PreConditions/RequireRole.cs index fd0b633..3416044 100644 --- a/ChaosBot/Discord/PreConditions/RequireRole.cs +++ b/ChaosBot/Discord/PreConditions/RequireRole.cs @@ -16,6 +16,11 @@ public class RequireRole : PreconditionAttribute { if (context.User is SocketGuildUser gUser) { + /* + * Owner has access to all commands + */ + if(context.Guild.OwnerId == context.User.Id) return Task.FromResult(PreconditionResult.FromSuccess()); + var requiredGroup = (ConfigurationRepository.GetValue($"Role:{_role}", context.Guild.Id) != null) ? ConfigurationRepository.GetValue($"Role:{_role}", context.Guild.Id) : _role; if (gUser.Roles.Any(r => r.Name == requiredGroup))