diff --git a/Core b/Core index e809da7..bd9c909 160000 --- a/Core +++ b/Core @@ -1 +1 @@ -Subproject commit e809da7468e7cbad117542d6d20cb4c7ef415290 +Subproject commit bd9c90981cebc9c15eb5632de9d05ec56c9c82a1 diff --git a/Modules/Moderation.cs b/Modules/Moderation.cs index b2557fe..5866cd0 100644 --- a/Modules/Moderation.cs +++ b/Modules/Moderation.cs @@ -36,6 +36,7 @@ public class Moderation: IModule private const string MuteNotFoundString = "And who would you like me to ~~kill~~ _silence_?"; private const string InvalidArgumentsString = "Invalid arguments.\n"; private const string BanReasonTooLongString = "Mute, Kick & Ban reason has 512 characters limit.\n"; + private const string BanExceedsLimit = "Trying to kick or ban too many.\n_(This is a limit configurable on the web config under the Moderation section)_\n"; private const string RoleNotFoundString = "The Muted role is not configured - head to "; private ValkyrjaClient Client; @@ -624,6 +625,13 @@ bool IsAuthorSpecific(IMessage m) return; } + if( e.Server.Config.BanLimit > 0 && mentionedUsers.Count > e.Server.Config.BanLimit && e.Command.Id.ToLower() != "kickmany" ) + { + await e.SendReplySafe(BanExceedsLimit); + dbContext.Dispose(); + return; + } + string response = ""; List usernames = new List(); StringBuilder infractions = new StringBuilder(); @@ -676,6 +684,11 @@ bool IsAuthorSpecific(IMessage m) }; commands.Add(newCommand); + newCommand = newCommand.CreateCopy("kickMany"); + newCommand.Description = "Kick many, exceeding the limits."; + newCommand.RequiredPermissions = PermissionType.ServerOwner; + commands.Add(newCommand); + // !ban newCommand = new Command("ban"); newCommand.Type = CommandType.Standard; @@ -755,6 +768,13 @@ bool IsAuthorSpecific(IMessage m) return; } + if( e.Server.Config.BanLimit > 0 && mentionedUsers.Count > e.Server.Config.BanLimit && e.Command.Id.ToLower() != "banmany" ) + { + await e.SendReplySafe(BanExceedsLimit); + dbContext.Dispose(); + return; + } + try { response = await Ban(e.Server, mentionedUsers, duration.Value, warning.ToString(), e.Message.Author as SocketGuildUser, @@ -783,6 +803,11 @@ bool IsAuthorSpecific(IMessage m) newCommand.Description = "Ban someone just like the usual, but do not log their user ID or #discrim."; commands.Add(newCommand); + newCommand = newCommand.CreateCopy("banMany"); + newCommand.Description = "Ban many, exceeding the limits."; + newCommand.RequiredPermissions = PermissionType.ServerOwner; + commands.Add(newCommand); + // !quickBan newCommand = new Command("quickBan"); newCommand.Type = CommandType.Standard;