mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-15 18:20:11 +00:00
feat: logclean for annabelle's embed log format
This commit is contained in:
parent
f99e10ae08
commit
4abe438111
1 changed files with 10 additions and 0 deletions
|
|
@ -40,6 +40,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 _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 _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 _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 =
|
private static readonly Regex _VortexRegex =
|
||||||
new("`\\[(\\d\\d:\\d\\d:\\d\\d)\\]` .* \\(ID:(\\d{17,19})\\).* <#\\d{17,19}>:");
|
new("`\\[(\\d\\d:\\d\\d:\\d\\d)\\]` .* \\(ID:(\\d{17,19})\\).* <#\\d{17,19}>:");
|
||||||
|
|
@ -75,6 +76,7 @@ public class LoggerCleanService
|
||||||
new LoggerBot("ProBot Prime", 567703512763334685, fuzzyExtractFunc: ExtractProBot), // webhook (?)
|
new LoggerBot("ProBot Prime", 567703512763334685, fuzzyExtractFunc: ExtractProBot), // webhook (?)
|
||||||
new LoggerBot("Dozer", 356535250932858885, ExtractDozer),
|
new LoggerBot("Dozer", 356535250932858885, ExtractDozer),
|
||||||
new LoggerBot("Skyra", 266624760782258186, ExtractSkyra),
|
new LoggerBot("Skyra", 266624760782258186, ExtractSkyra),
|
||||||
|
new LoggerBot("Annabelle", 231241068383961088, ExtractAnnabelle),
|
||||||
}.ToDictionary(b => b.Id);
|
}.ToDictionary(b => b.Id);
|
||||||
|
|
||||||
private static Dictionary<ulong, LoggerBot> _botsByApplicationId
|
private static Dictionary<ulong, LoggerBot> _botsByApplicationId
|
||||||
|
|
@ -383,6 +385,14 @@ public class LoggerCleanService
|
||||||
return match.Success ? ulong.Parse(match.Groups[3].Value) : null;
|
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 class LoggerBot
|
||||||
{
|
{
|
||||||
public ulong Id;
|
public ulong Id;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue