feat: add logclean support for Dozer bot (#580)

This commit is contained in:
rladenson 2023-08-04 20:31:16 -06:00 committed by Iris System
parent deeb3ad3a4
commit 878ca63b65
2 changed files with 10 additions and 0 deletions

View file

@ -38,6 +38,7 @@ public class LoggerCleanService
private static readonly Regex _GearBotRegex = new("\\(``(\\d{17,19})``\\) in <#\\d{17,19}> has been removed.");
private static readonly Regex _GiselleRegex = new("\\*\\*Message ID\\*\\*: `(\\d{17,19})`");
private static readonly Regex _ProBotRegex = new("\\*\\*Message sent by <@(\\d{17,19})> deleted in <#\\d{17,19}>.\\*\\*");
private static readonly Regex _DozerRegex = new("Message ID: (\\d{17,19}) - (\\d{17,19})\nUserID: (\\d{17,19})");
private static readonly Regex _VortexRegex =
new("`\\[(\\d\\d:\\d\\d:\\d\\d)\\]` .* \\(ID:(\\d{17,19})\\).* <#\\d{17,19}>:");
@ -71,6 +72,7 @@ public class LoggerCleanService
new LoggerBot("Vortex", 240254129333731328, fuzzyExtractFunc: ExtractVortex),
new LoggerBot("ProBot", 282859044593598464, fuzzyExtractFunc: ExtractProBot), // webhook
new LoggerBot("ProBot Prime", 567703512763334685, fuzzyExtractFunc: ExtractProBot), // webhook (?)
new LoggerBot("Dozer", 356535250932858885, ExtractDozer),
}.ToDictionary(b => b.Id);
private static Dictionary<ulong, LoggerBot> _botsByApplicationId
@ -363,6 +365,13 @@ public class LoggerCleanService
}
: null;
}
private static ulong? ExtractDozer(Message msg)
{
var embed = msg.Embeds?.FirstOrDefault();
var match = _DozerRegex.Match(embed?.Footer.Text);
return match.Success ? ulong.Parse(match.Groups[2].Value) : null;
}
public class LoggerBot
{