Add checks to kick command

This commit is contained in:
Noi 2020-08-11 18:48:29 -07:00
parent 057f7937fe
commit fbd310ba35
2 changed files with 15 additions and 1 deletions

View file

@ -124,6 +124,20 @@ namespace Noikoio.RegexBot.Module.ModCommands.Commands
return;
}
// Hierarchy check
if ((msg.Author as SocketGuildUser).Hierarchy <= targetobj.Hierarchy)
{
// Block kick attempts if the invoking user is at or above the target in role hierarchy
await SendUsageMessageAsync(msg.Channel, ":x: You are not allowed to kick this user.");
return;
}
// Bot check
if (targetobj.IsBot)
{
await SendUsageMessageAsync(msg.Channel, ":x: I will not do that. Please kick bots manually.");
return;
}
// Send out message
var notifyTask = SendNotificationMessage(targetobj, reason);

View file

@ -7,7 +7,7 @@
<Description>Highly configurable Discord moderation bot</Description>
<Authors>Noikoio</Authors>
<Company />
<Version>2.6.5</Version>
<Version>2.6.6</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">