From 37ce3bca68710df27e5ff5141d62380f4d8f179e Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 25 Nov 2019 20:58:15 +0500 Subject: [PATCH 1/3] update warning list logic a bit --- CompatBot/Commands/Warnings.cs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/CompatBot/Commands/Warnings.cs b/CompatBot/Commands/Warnings.cs index 49821f03..98cac1aa 100644 --- a/CompatBot/Commands/Warnings.cs +++ b/CompatBot/Commands/Warnings.cs @@ -216,24 +216,23 @@ namespace CompatBot.Commands } if (count == 0) { - if (removed == 0) + if (isKot && isDoggo) { - if (isKot && isDoggo) - { - if (new Random().NextDouble() < 0.5) - isKot = false; - else - isDoggo = false; - } - if (isKot) - await message.RespondAsync($"{userName} has no warnings, is an upstanding kot, and a paw bean of this community").ConfigureAwait(false); - else if (isDoggo) - await message.RespondAsync($"{userName} has no warnings, is a good boy, and a wiggling tail of this community").ConfigureAwait(false); + if (new Random().NextDouble() < 0.5) + isKot = false; else - await message.RespondAsync($"{userName} has no warnings, is an upstanding citizen, and a pillar of this community").ConfigureAwait(false); + isDoggo = false; } - else - await message.RespondAsync(userName + " has no warnings" + (isPrivate ? $" ({removed} retracted warning{(removed == 1 ? "" : "s")})" : "")).ConfigureAwait(false); + var msg = (removed, isKot, isDoggo) switch + { + (0, true, false) => $"{userName} has no warnings, is an upstanding kot, and a paw bean of this community", + (0, false, true) => $"{userName} has no warnings, is a good boy, and a wiggling tail of this community", + (0, _, _) => $"{userName} has no warnings, is an upstanding citizen, and a pillar of this community", + (_, true, false) => $"{userName} has no warnings{(isPrivate ? $" ({removed} retracted warning{(removed == 1 ? "" : "s")}), but are they a good kot?" : "")}", + (_, false, true) => $"{userName} has no warnings{(isPrivate ? $" ({removed} retracted warning{(removed == 1 ? "" : "s")}), but are they a good boy?" : "")}", + _ => $"{userName} has no warnings{(isPrivate ? $" ({removed} retracted warning{(removed == 1 ? "" : "s")})" : "")}", + }; + await message.RespondAsync(msg).ConfigureAwait(false); return; } From bd0433038c8a491dfcdf32983e35581e5aba0c76 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 25 Nov 2019 21:33:19 +0500 Subject: [PATCH 2/3] log removed message info --- CompatBot/Database/Providers/ContentFilter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CompatBot/Database/Providers/ContentFilter.cs b/CompatBot/Database/Providers/ContentFilter.cs index 6153388c..48285a99 100644 --- a/CompatBot/Database/Providers/ContentFilter.cs +++ b/CompatBot/Database/Providers/ContentFilter.cs @@ -118,6 +118,8 @@ namespace CompatBot.Database.Providers try { await message.Channel.DeleteMessageAsync(message, $"Removed according to filter '{trigger}'").ConfigureAwait(false); + var author = client.GetMember(message.Author); + Config.Log.Debug($"Removed message from {author.GetMentionWithNickname()} in #{message.Channel.Name}: {message.Content}"); completedActions.Add(FilterAction.RemoveContent); } catch From eac090b2769b4fdbc067c91f5b1bb7e4df65ced2 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 25 Nov 2019 22:27:09 +0500 Subject: [PATCH 3/3] fix stupid bug with the dlc region check --- .../LogParserResultFormatter.GeneralNotesSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs index 161678fe..1d0cfd73 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs @@ -512,7 +512,7 @@ namespace CompatBot.Utils.ResultFormatters builder.AddField("Missing Licenses", content); var gameRegion = items["serial"] is string serial && serial.Length > 3 ? new[] {serial[2]} : Enumerable.Empty(); - var dlcRegions = licenseNames.Select(n => n[2]).Concat(gameRegion).Distinct().ToArray(); + var dlcRegions = licenseNames.Select(n => n[9]).Concat(gameRegion).Distinct().ToArray(); if (dlcRegions.Length > 1) generalNotes.Add($"🤔 Very interesting DLC collection from {dlcRegions.Length} different regions you got there"); }