fixed permissions bug
This commit is contained in:
parent
11fc9297c4
commit
c3addbf3fa
@ -264,6 +264,7 @@ namespace NadekoBot.Services
|
|||||||
|
|
||||||
var cmd = commands[i].Command;
|
var cmd = commands[i].Command;
|
||||||
bool resetCommand = cmd.Name == "ResetPermissions";
|
bool resetCommand = cmd.Name == "ResetPermissions";
|
||||||
|
var module = cmd.Module.GetTopLevelModule();
|
||||||
PermissionCache pc;
|
PermissionCache pc;
|
||||||
if (context.Guild != null)
|
if (context.Guild != null)
|
||||||
{
|
{
|
||||||
@ -281,14 +282,14 @@ namespace NadekoBot.Services
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
int index;
|
int index;
|
||||||
if (!resetCommand && !pc.RootPermission.AsEnumerable().CheckPermissions(context.Message, cmd.Aliases.First(), cmd.Module.Name, out index))
|
if (!resetCommand && !pc.RootPermission.AsEnumerable().CheckPermissions(context.Message, cmd.Aliases.First(), module.Name, out index))
|
||||||
{
|
{
|
||||||
var returnMsg = $"Permission number #{index + 1} **{pc.RootPermission.GetAt(index).GetCommand((SocketGuild)context.Guild)}** is preventing this action.";
|
var returnMsg = $"Permission number #{index + 1} **{pc.RootPermission.GetAt(index).GetCommand((SocketGuild)context.Guild)}** is preventing this action.";
|
||||||
return new ExecuteCommandResult(cmd, pc, SearchResult.FromError(CommandError.Exception, returnMsg));
|
return new ExecuteCommandResult(cmd, pc, SearchResult.FromError(CommandError.Exception, returnMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (cmd.Module.Name == typeof(Permissions).Name)
|
if (module.Name == typeof(Permissions).Name)
|
||||||
{
|
{
|
||||||
if (!((IGuildUser)context.User).GetRoles().Any(r => r.Name.Trim().ToLowerInvariant() == pc.PermRole.Trim().ToLowerInvariant()))
|
if (!((IGuildUser)context.User).GetRoles().Any(r => r.Name.Trim().ToLowerInvariant() == pc.PermRole.Trim().ToLowerInvariant()))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user