mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: logclean for annabelle's embed log format
This commit is contained in:
parent
3bf1203234
commit
ee43ad8f83
1 changed files with 10 additions and 0 deletions
|
|
@ -42,6 +42,7 @@ public class LoggerCleanService
|
|||
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 _SkyraRegex = new("https://discord.com/channels/(\\d{17,19})/(\\d{17,19})/(\\d{17,19})");
|
||||
private static readonly Regex _AnnabelleRegex = new("```\n(\\d{17,19})\n```");
|
||||
|
||||
private static readonly Regex _VortexRegex =
|
||||
new("`\\[(\\d\\d:\\d\\d:\\d\\d)\\]` .* \\(ID:(\\d{17,19})\\).* <#\\d{17,19}>:");
|
||||
|
|
@ -79,6 +80,7 @@ public class LoggerCleanService
|
|||
new LoggerBot("ProBot Prime", 567703512763334685, fuzzyExtractFunc: ExtractProBot), // webhook (?)
|
||||
new LoggerBot("Dozer", 356535250932858885, ExtractDozer),
|
||||
new LoggerBot("Skyra", 266624760782258186, ExtractSkyra),
|
||||
new LoggerBot("Annabelle", 231241068383961088, ExtractAnnabelle),
|
||||
}.ToDictionary(b => b.Id);
|
||||
|
||||
private static Dictionary<ulong, LoggerBot> _botsByApplicationId
|
||||
|
|
@ -407,6 +409,14 @@ public class LoggerCleanService
|
|||
return match.Success ? ulong.Parse(match.Groups[3].Value) : null;
|
||||
}
|
||||
|
||||
private static ulong? ExtractAnnabelle(Message msg)
|
||||
{
|
||||
var embed = msg.Embeds?.FirstOrDefault();
|
||||
if (embed?.Author?.Name == null || !embed.Author.Name.EndsWith("Deleted Message")) return null;
|
||||
var match = _AnnabelleRegex.Match(embed.Fields[2].Value);
|
||||
return match.Success ? ulong.Parse(match.Groups[1].Value) : null;
|
||||
}
|
||||
|
||||
public class LoggerBot
|
||||
{
|
||||
public ulong Id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue