public async Task SetTimeLimit(int seconds) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.SpamSettings.SecondsToCheck = seconds; ModerationService.SaveModerationConfig(config); await ReplyAsync($"Max Messages per {config.SpamSettings.SecondsToCheck} Seconds Set. {config.SpamSettings.MessagesPerTime}/{config.SpamSettings.SecondsToCheck}s"); }
public async Task ToggleToxicityAsync() { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.UsePerspective = !config.UsePerspective; ModerationService.SaveModerationConfig(config); await ReplyAsync($"Toxic message checking: {config.UsePerspective}"); }
public async Task BlacklistUsernameRemove([Remainder] string name) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.BlacklistedUsernames = config.BlacklistedUsernames.Where(x => x.Content.Equals(name, StringComparison.InvariantCultureIgnoreCase)).ToList(); ModerationService.SaveModerationConfig(config); await ReplyAsync($"Removed."); }
public async Task ToggleBlacklistAsync() { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.UseBlacklist = !config.UseBlacklist; ModerationService.SaveModerationConfig(config); await ReplyAsync($"Using Blacklist: {config.UseBlacklist}"); }
public async Task ToggleIpsAsync() { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.BlockIps = !config.BlockIps; ModerationService.SaveModerationConfig(config); await ReplyAsync($"IP Address Blocking: {config.BlockIps}"); }
public async Task ToggleAntiSpam() { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.UseAntiSpam = !config.UseAntiSpam; ModerationService.SaveModerationConfig(config); await ReplyAsync($"Use AntiSpam: {config.UseAntiSpam}\n" + $"Cache Size: {config.SpamSettings.CacheSize}\n" + $"Max Message Repititions per {config.SpamSettings.CacheSize} Messages: {config.SpamSettings.MaxRepititions}\n" + $"Seconds to Check for Spam: {config.SpamSettings.SecondsToCheck}\n" + $"Messages per {config.SpamSettings.SecondsToCheck} Seconds: {config.SpamSettings.MessagesPerTime}"); }
public async Task ToggleMentionsAsync() { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.BlockMassMentions = !config.BlockMassMentions; ModerationService.SaveModerationConfig(config); await ReplyAsync("Mass Mention Config: \n" + $"Block Mass Mentions: {config.BlockMassMentions}\n" + $"Channels Count: {config.MassMentionsIncludeChannels}\n" + $"Users Count: {config.MassMentionsIncludeUsers}\n" + $"Roles Count: {config.MassMentionsIncludeRoles}"); }
public async Task BlacklistUsernameRegexAdd([Remainder] string name) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.BlacklistedUsernames.Add(new BlacklistSet.BlacklistMessage { Content = name, Regex = true }); ModerationService.SaveModerationConfig(config); await ReplyAsync("Added."); }
public async Task SetMaxToxicityAsync(int max) { if (max > 50 && max < 100) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.PerspectiveMax = max; ModerationService.SaveModerationConfig(config); await ReplyAsync($"Toxic Message Max Percentage: {config.PerspectiveMax}"); } else { await ReplyAsync("Max value must be between 50 and 100"); } }
public async Task SetMessagesPerTime(int count) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); var result = config.SpamSettings.SetMaxMessagesPerTime(count); if (result) { ModerationService.SaveModerationConfig(config); await ReplyAsync($"Max Messages per {config.SpamSettings.SecondsToCheck} Seconds Set to {config.SpamSettings.MessagesPerTime}"); } else { await ReplyAsync($"Message count must be less than the cache size:\n" + $"Current Cache Size: {config.SpamSettings.CacheSize}"); } }
public async Task SetMaxRepititions(int count) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); var result = config.SpamSettings.SetMaxRepititions(count); if (result) { ModerationService.SaveModerationConfig(config); await ReplyAsync("Max Repititions Set."); } else { await ReplyAsync($"Repitition count must be less than the cache size:\n" + $"Current Cache Size: {config.SpamSettings.CacheSize}"); } }
public async Task AutomodExempt(IRole role) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); if (config.AutoModExempt.Contains(role.Id)) { config.AutoModExempt.Remove(role.Id); await ReplyAsync($"Role removed from auto-mod exempt list."); } else { config.AutoModExempt.Add(role.Id); await ReplyAsync($"Role added to auto-mod exempt list."); } ModerationService.SaveModerationConfig(config); }
public async Task SetCacheSize(int size) { var config = ModerationService.GetModerationConfig(Context.Guild.Id); var result = config.SpamSettings.SetCacheSize(size); if (result) { ModerationService.SaveModerationConfig(config); await ReplyAsync("Cache Size Set."); } else { await ReplyAsync($"Cache size must be greater than max repititions or messages per x seconds:\n" + $"Current Cache Size: {config.SpamSettings.CacheSize}\n" + $"Max Message Repititions per {config.SpamSettings.CacheSize} Messages: {config.SpamSettings.MaxRepititions}\n" + $"Messages per {config.SpamSettings.SecondsToCheck} Seconds: {config.SpamSettings.MessagesPerTime}"); } }
public async Task ShowSettings() { var config = ModerationService.GetModerationConfig(Context.Guild.Id); var blacklistSimpleSet = config.BlacklistSimple.Select(x => { if (x.Regex) { return($"Regex Check: {x.Content}"); } return(x.Content); }).ToList(); var exemptlist = config.AutoModExempt.Select(x => Context.Guild.Roles.FirstOrDefault(r => r.Id == x)).Where(x => x != null).Select(x => x.Mention); await ReplyAsync("**AUTO-MOD SETTINGS**\n" + $"Block Invites: {config.BlockInvites}\n" + $"Block IP Addresses: {config.BlockIps}\n" + $"Block Mass Mentions: {config.BlockMassMentions}\n" + $"Maximum Mentions: {config.MaxMentions}\n" + $"Mass Mentions includes Users: {config.MassMentionsIncludeUsers}\n" + $"Mass Mentions includes Roles: {config.MassMentionsIncludeRoles}\n" + $"Mass Mentions includes Channels: {config.MassMentionsIncludeChannels}\n" + $"**TOXICITY SETTINGS (PERSPECTIVE)**\n" + $"Use Perspective: {config.UsePerspective}\n" + $"Max Toxicity Percent: {config.PerspectiveMax}%\n" + $"**ANTI-SPAM SETTINGS**\n" + $"Use Anti-Spam: {config.UseAntiSpam}\n" + $"Message Cache Size: {config.SpamSettings.CacheSize}\n" + $"Max Messages per x Second(s): {config.SpamSettings.MessagesPerTime} messages per {config.SpamSettings.SecondsToCheck} second(s)\n" + $"Max Identical Messages: {config.SpamSettings.MaxRepititions}\n" + $"**BLACKLIST SETTINGS**\n" + $"Use Blacklist: {config.UseBlacklist}\n" + $"Blacklisted Words: \n{string.Join("\n", blacklistSimpleSet)}\n" + $"\n*Complex Blacklist is currently disabled for ALL Servers as it is still being developed.*\n" + $"**BLACKLIST USERNAMES**\n" + $"Blacklist Usernames: {config.BlacklistUsernames}\n" + $"Blacklisted Usernames: \n{string.Join("\n", config.BlacklistedUsernames)}\n" + $"**AUTOMOD EXEMPT**\n" + $"All Admin Roles\n" + $"Automod Exempt Roles: \n" + $"{string.Join("\n", exemptlist)}".FixLength(2047)); }
public async Task BlacklistAdd([Remainder] string message) { if (message.Length < 3) { await ReplyAsync("It's not a good idea to add such short items to the blacklist."); return; } var config = ModerationService.GetModerationConfig(Context.Guild.Id); config.BlacklistSimple.Add(new BlacklistSet.BlacklistMessage { Content = message, Regex = false }); ModerationService.SaveModerationConfig(config); await ReplyAsync("Added."); }