Set Server Owner to have permission for all commands.

This commit is contained in:
Sean "Solao Bajiuik" Stoves 2020-06-15 22:09:44 -04:00
parent 80f6cf0803
commit ddce0a9504

View File

@ -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<string>($"Role:{_role}", context.Guild.Id) != null) ? ConfigurationRepository.GetValue<string>($"Role:{_role}", context.Guild.Id) : _role;
if (gUser.Roles.Any(r => r.Name == requiredGroup))