Make it impossible to add roles with evaluated permissions to self service (because people are stupid enough to do so apparently)

This commit is contained in:
Runebaas 2017-10-19 23:55:09 +02:00
parent 75c699e25b
commit 73f29a5cf1
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6

View file

@ -93,6 +93,20 @@ namespace Geekbot.net.Commands
{
try
{
if (role.IsManaged)
{
await ReplyAsync("You can't add a role that is managed by discord");
return;
}
if (role.Permissions.ManageRoles
|| role.Permissions.Administrator
|| role.Permissions.ManageGuild
|| role.Permissions.BanMembers
|| role.Permissions.KickMembers)
{
await ReplyAsync("Woah, i don't think you want to add that role to self service as it contains some dangerous permissions");
return;
}
_redis.HashSet($"{Context.Guild.Id}:RoleWhitelist", new HashEntry[] { new HashEntry(roleName, role.Id.ToString()) });
await ReplyAsync($"Added {role.Name} to the whitelist");
}