Fix arbitrary ID banning not working under certain conditions

This commit is contained in:
Noi 2021-09-30 13:47:25 -07:00
parent f16628a44e
commit affaf88425

View file

@ -124,6 +124,15 @@ namespace Noikoio.RegexBot.Module.ModCommands.Commands
return;
}
// Checks for existing (found) users:
if (targetobj != null)
{
// Bot check
if (targetobj.IsBot)
{
await SendUsageMessageAsync(msg.Channel, ":x: I will not do that. Please kick bots manually.");
return;
}
// Hierarchy check
if ((msg.Author as SocketGuildUser).Hierarchy <= targetobj.Hierarchy)
{
@ -131,11 +140,6 @@ namespace Noikoio.RegexBot.Module.ModCommands.Commands
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
@ -144,7 +148,7 @@ namespace Noikoio.RegexBot.Module.ModCommands.Commands
// Do the action
try
{
string reasonlog = $"Invoked by {msg.Author.ToString()}.";
string reasonlog = $"Invoked by {msg.Author}.";
if (reason != null) reasonlog += $" Reason: {reason}";
await notifyTask;
#if !DEBUG