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
@ -364,6 +366,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
{
public ulong Id;

View file

@ -25,6 +25,7 @@ At the moment, log cleanup works with the following bots:
- [blargbot](https://blargbot.xyz/) (precise)
- [Carl-bot](https://carl.gg/) (precise)
- [Circle](https://circlebot.xyz/) (fuzzy)
- [Dozer](https://github.com/frcdiscord/dozer) (precise)
- [Dyno](https://dyno.gg/) (precise)
- [GearBot](https://gearbot.rocks/) (fuzzy)
- [GenericBot](https://github.com/galenguyer/GenericBot) (precise)