diff --git a/PluralKit.Bot/Services/LoggerCleanService.cs b/PluralKit.Bot/Services/LoggerCleanService.cs index 632541a5..9c108b07 100644 --- a/PluralKit.Bot/Services/LoggerCleanService.cs +++ b/PluralKit.Bot/Services/LoggerCleanService.cs @@ -23,12 +23,13 @@ namespace PluralKit.Bot private static Regex _loggerBRegex = new Regex("MessageID:(\\d{17,19})"); private static Regex _auttajaRegex = new Regex("Message (\\d{17,19}) deleted"); private static Regex _mantaroRegex = new Regex("Message \\(?ID:? (\\d{17,19})\\)? created by .* in channel .* was deleted\\."); + private static Regex _pancakeRegex = new Regex("Message from <@(\\d{17,19})> deleted in"); private static readonly Dictionary _bots = new[] { - // These are NOT supported at the moment, since they don't put the deleted message ID in the log new LoggerBot("Carl-bot", 23514896210395136, fuzzyExtractFunc: ExtractCarlBot, webhookName: "Carl-bot Logging"), new LoggerBot("Circle", 497196352866877441, fuzzyExtractFunc: ExtractCircle), + new LoggerBot("Pancake", 239631525350604801, fuzzyExtractFunc: ExtractPancake), // There are two "Logger"s. They seem to be entirely unrelated. Don't ask. new LoggerBot("Logger#6088", 298822483060981760 , ExtractLoggerA, webhookName: "Logger"), @@ -219,6 +220,18 @@ namespace PluralKit.Bot : (FuzzyExtractResult?) null; } + private static FuzzyExtractResult? ExtractPancake(SocketMessage msg) + { + // Embed, title is "Message Deleted", description includes a mention, timestamp is *message send time* (but no ID) + // so we use the message timestamp to get somewhere *after* the message was proxied + var embed = msg.Embeds.FirstOrDefault(); + if (embed?.Description == null || embed.Author?.Name != "Message Deleted") return null; + var match = _pancakeRegex.Match(embed.Description); + return match.Success + ? new FuzzyExtractResult {User = ulong.Parse(match.Groups[1].Value), ApproxTimestamp = msg.Timestamp} + : (FuzzyExtractResult?) null; + } + public class LoggerBot { public string Name; diff --git a/docs/2-user-guide.md b/docs/2-user-guide.md index da68ebe6..29be49f8 100644 --- a/docs/2-user-guide.md +++ b/docs/2-user-guide.md @@ -493,6 +493,8 @@ This requires you to have the *Manage Server* permission on the server. At the m - Dyno - GenericBot - Logger (#6088 and #6278) +- Mantaro +- Pancake If you want support for another logging bot, [let me know on the support server](https://discord.gg/PczBt78).