Guild owners can now run permission commands without permission role
This commit is contained in:
parent
09691adcc6
commit
70bbecbc8f
@ -348,7 +348,8 @@ namespace NadekoBot.Services
|
|||||||
|
|
||||||
if (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()))
|
var guildUser = (IGuildUser)context.User;
|
||||||
|
if (!guildUser.GetRoles().Any(r => r.Name.Trim().ToLowerInvariant() == pc.PermRole.Trim().ToLowerInvariant()) && guildUser.Id != guildUser.Guild.OwnerId)
|
||||||
{
|
{
|
||||||
return new ExecuteCommandResult(cmd, pc, SearchResult.FromError(CommandError.Exception, $"You need the **{pc.PermRole}** role in order to use permission commands."));
|
return new ExecuteCommandResult(cmd, pc, SearchResult.FromError(CommandError.Exception, $"You need the **{pc.PermRole}** role in order to use permission commands."));
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,20 @@ namespace NadekoBot.Services.Database.Models
|
|||||||
public class CommandPrice : DbEntity
|
public class CommandPrice : DbEntity
|
||||||
{
|
{
|
||||||
public int Price { get; set; }
|
public int Price { get; set; }
|
||||||
|
//this is unique
|
||||||
public string CommandName { get; set; }
|
public string CommandName { get; set; }
|
||||||
|
|
||||||
|
public override int GetHashCode() =>
|
||||||
|
CommandName.GetHashCode();
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
var instance = obj as CommandPrice;
|
||||||
|
|
||||||
|
if (instance == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return instance.CommandName == CommandName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user