From dffaab09eb5984cd1e43761de754bd922f29ab47 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Fri, 9 Jan 2026 21:57:37 +0500 Subject: [PATCH 1/4] add note for iso mount --- .../EventHandlers/LogParsing/LogParser.LogSections.cs | 1 + .../EventHandlers/LogParsing/LogParser.RegexPatterns.cs | 2 ++ .../LogParserResultFormatter.GeneralNotesSection.cs | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs b/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs index beae1ebe..20fa4802 100644 --- a/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs +++ b/CompatBot/EventHandlers/LogParsing/LogParser.LogSections.cs @@ -184,6 +184,7 @@ internal partial class LogParser ["SYS: Title was set from"] = TitleWasSet(), ["SYS: Path:"] = DigitalPathSys(), ["SYS: Boot path:"] = BootPathInBodySys(), + ["SYS: Disc:"] = DiscMountSys(), ["Elf path:"] = ElfPath(), ["VFS: Mounted path \"/dev_bdvd\""] = VfsMountPath(), ["Invalid or unsupported file format:"] = InvalidFileFormat(), diff --git a/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs b/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs index 07419d3b..879d4dc9 100644 --- a/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs +++ b/CompatBot/EventHandlers/LogParsing/LogParser.RegexPatterns.cs @@ -248,6 +248,8 @@ internal partial class LogParser private static partial Regex DigitalPathSys(); [GeneratedRegex(@"Boot path: (?.*(?/dev_hdd0/game/(?[^/\r\n]+)).*|[^\r\n]*)\r?$", DefaultOptions)] private static partial Regex BootPathInBodySys(); + [GeneratedRegex(@"SYS: Disc: /(?\w+)/\r?$", DefaultOptions)] + private static partial Regex DiscMountSys(); [GeneratedRegex(@"Elf path: (?/host_root/)?(?(?/dev_hdd0/game/(?[^/\r\n]+)/USRDIR/EBOOT\.BIN|.*?))\r?$", DefaultOptions)] private static partial Regex ElfPath(); [GeneratedRegex(@"Mounted path ""/dev_bdvd"" to ""(?[^""]+)""", DefaultOptions)] diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs index 76c21e22..2d189df5 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs @@ -116,7 +116,12 @@ internal static partial class LogParserResult notes.Add("❌ Disc version of the game inside the `/dev_hdd0/game/` directory"); if (serial is {Length: >0} && isElf) notes.Add($"⚠️ Retail game booted directly through `{Path.GetFileName(elfBootPath)}`, which is not recommended"); - if (items["mounted_dev_bdvd"] is { Length: > 0 } mountedBdvd + + if (items["vfs_disc_mount"] is "vfsv0_virtual_iso_overlay_fs_dev") + { + notes.Add("ℹ️ Booted from ISO"); + } + else if (items["mounted_dev_bdvd"] is { Length: > 0 } mountedBdvd && items["os_type"] is {Length: >0} osType && mountedBdvd.Split('/', StringSplitOptions.RemoveEmptyEntries) is {Length: <3} segments && (osType is "Windows" && segments is [[_, ':']] // D:/ From b099d681cce7337bb5f21ba67e30fb36476072c9 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Fri, 9 Jan 2026 22:04:38 +0500 Subject: [PATCH 2/4] upgrade deps --- Clients/GithubClient/GithubClient.csproj | 2 +- Clients/IrdLibraryClient/IrdLibraryClient.csproj | 2 +- CompatBot/CompatBot.csproj | 4 ++-- Tests/Tests.csproj | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Clients/GithubClient/GithubClient.csproj b/Clients/GithubClient/GithubClient.csproj index 4f6673b6..bbe16a6f 100644 --- a/Clients/GithubClient/GithubClient.csproj +++ b/Clients/GithubClient/GithubClient.csproj @@ -7,7 +7,7 @@ - + diff --git a/Clients/IrdLibraryClient/IrdLibraryClient.csproj b/Clients/IrdLibraryClient/IrdLibraryClient.csproj index 59c695c5..0a96ee16 100644 --- a/Clients/IrdLibraryClient/IrdLibraryClient.csproj +++ b/Clients/IrdLibraryClient/IrdLibraryClient.csproj @@ -5,7 +5,7 @@ enable - + diff --git a/CompatBot/CompatBot.csproj b/CompatBot/CompatBot.csproj index aa932e48..0a60ba7e 100644 --- a/CompatBot/CompatBot.csproj +++ b/CompatBot/CompatBot.csproj @@ -64,7 +64,7 @@ - + @@ -72,7 +72,7 @@ - + diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index ef5b35d0..267b6f8b 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -10,7 +10,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 30a1c637b7714e3964d546852fea6562b6b536bd Mon Sep 17 00:00:00 2001 From: 13xforever Date: Fri, 9 Jan 2026 22:35:47 +0500 Subject: [PATCH 3/4] update antispam filter with support for attachment-only messages --- .../EventHandlers/AntiSpamMessageHandler.cs | 39 +++++++++++++++---- CompatBot/Utils/DiscordAttachmentComparer.cs | 20 ++++++++++ 2 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 CompatBot/Utils/DiscordAttachmentComparer.cs diff --git a/CompatBot/EventHandlers/AntiSpamMessageHandler.cs b/CompatBot/EventHandlers/AntiSpamMessageHandler.cs index 4adde9f9..3de465f3 100644 --- a/CompatBot/EventHandlers/AntiSpamMessageHandler.cs +++ b/CompatBot/EventHandlers/AntiSpamMessageHandler.cs @@ -28,25 +28,35 @@ public static class AntiSpamMessageHandler Config.Log.Debug($"Removed checkpoint spam message from user {author.Username} ({author.Id}) in #{msg.Channel?.Name}"); return false; } - - if (msg.Content is not { Length: >0 }) - return true; + if (MessageCache.TryGetValue(author.Id, out var item) - && item is (DiscordMessage { Content.Length: >0 } lastMessage, bool isWarned) - && lastMessage.Content == msg.Content + && item is (DiscordMessage lastMessage, bool isWarned) + && SameContent(lastMessage, msg) && lastMessage.ChannelId != msg.ChannelId) { var removedSpam = false; try { await msg.DeleteAsync("spam").ConfigureAwait(false); + removedSpam = true; + + var newMsgContent = ""; + if (msg.Content is { Length: > 0 }) + { + newMsgContent = msg.Content; + } + else if (msg is { Attachments.Count: > 0 }) + { + foreach (var att in msg.Attachments) + newMsgContent += $"📎 {att.FileName}\n"; + newMsgContent = newMsgContent.TrimEnd(); + } Config.Log.Debug($""" Removed spam message from user {author.Username} ({author.Id}) in #{msg.Channel?.Name}: - {msg.Content.Trim()} + {newMsgContent.Trim()} """ ); - removedSpam = true; } catch (Exception e) { @@ -71,4 +81,19 @@ public static class AntiSpamMessageHandler MessageCache.Set(author.Id, (msg, false), DefaultExpiration); return true; } + + private static bool SameContent(DiscordMessage msg1, DiscordMessage msg2) + { + if (msg1 is { Content.Length: > 0 } + && msg2 is { Content.Length: > 0 } + && msg1.Content == msg2.Content) + return true; + + if (msg1 is { Attachments.Count: > 0 } + && msg2 is { Attachments.Count: > 0 } + && msg1.Attachments.SequenceEqual(msg2.Attachments, DiscordAttachmentComparer.Instance)) + return true; + + return false; + } } \ No newline at end of file diff --git a/CompatBot/Utils/DiscordAttachmentComparer.cs b/CompatBot/Utils/DiscordAttachmentComparer.cs new file mode 100644 index 00000000..8344986e --- /dev/null +++ b/CompatBot/Utils/DiscordAttachmentComparer.cs @@ -0,0 +1,20 @@ +namespace CompatBot.Utils; + +internal class DiscordAttachmentComparer : IEqualityComparer +{ + bool IEqualityComparer.Equals(DiscordAttachment? x, DiscordAttachment? y) + { + if (x is null && y is null) + return true; + + if (x is null || y is null) + return false; + + return x.FileName == y.FileName && x.FileSize == y.FileSize; + } + + int IEqualityComparer.GetHashCode(DiscordAttachment obj) + => HashCode.Combine((obj.FileName ?? "").GetHashCode(), obj.FileSize.GetHashCode()); + + public static DiscordAttachmentComparer Instance { get; } = new DiscordAttachmentComparer(); +} From 1871815f6db9d71c3cc5e90fc5ecbb26bdee2082 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Fri, 9 Jan 2026 22:41:49 +0500 Subject: [PATCH 4/4] use jump links in bot log instead of channel link --- CompatBot/Utils/Extensions/DiscordClientExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CompatBot/Utils/Extensions/DiscordClientExtensions.cs b/CompatBot/Utils/Extensions/DiscordClientExtensions.cs index 936daee1..d0f55fc5 100644 --- a/CompatBot/Utils/Extensions/DiscordClientExtensions.cs +++ b/CompatBot/Utils/Extensions/DiscordClientExtensions.cs @@ -256,7 +256,7 @@ public static class DiscordClientExtensions Title = infraction, Color = GetColor(severity), }.AddField("Violator", author is null ? message.Author.Mention : GetMentionWithNickname(author), true) - .AddField("Channel", message.Channel.IsPrivate ? "Bot's DM" : message.Channel.Mention, true); + .AddField("Channel", message.Channel.IsPrivate ? "Bot's DM" : message.JumpLink.ToString(), true); if (filterId is not null) result.AddField("Filter #", filterId.ToString(), true); result.AddField("Content of the offending item", content.Trim(EmbedPager.MaxFieldLength));