mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: add logclean support for Skyra bot (#580)
Merges PluralKit/PluralKit#580
This commit is contained in:
parent
878ca63b65
commit
8a59ef5f50
2 changed files with 12 additions and 1 deletions
|
|
@ -39,6 +39,7 @@ public class LoggerCleanService
|
|||
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 _SkyraRegex = new("https://discord.com/channels/(\\d{17,19})/(\\d{17,19})/(\\d{17,19})");
|
||||
|
||||
private static readonly Regex _VortexRegex =
|
||||
new("`\\[(\\d\\d:\\d\\d:\\d\\d)\\]` .* \\(ID:(\\d{17,19})\\).* <#\\d{17,19}>:");
|
||||
|
|
@ -73,6 +74,7 @@ public class LoggerCleanService
|
|||
new LoggerBot("ProBot", 282859044593598464, fuzzyExtractFunc: ExtractProBot), // webhook
|
||||
new LoggerBot("ProBot Prime", 567703512763334685, fuzzyExtractFunc: ExtractProBot), // webhook (?)
|
||||
new LoggerBot("Dozer", 356535250932858885, ExtractDozer),
|
||||
new LoggerBot("Skyra", 266624760782258186, ExtractSkyra),
|
||||
}.ToDictionary(b => b.Id);
|
||||
|
||||
private static Dictionary<ulong, LoggerBot> _botsByApplicationId
|
||||
|
|
@ -373,6 +375,14 @@ public class LoggerCleanService
|
|||
return match.Success ? ulong.Parse(match.Groups[2].Value) : null;
|
||||
}
|
||||
|
||||
private static ulong? ExtractSkyra(Message msg)
|
||||
{
|
||||
var embed = msg.Embeds?.FirstOrDefault();
|
||||
if (embed?.Footer?.Text == null || !embed.Footer.Text.StartsWith("Message Deleted")) return null;
|
||||
var match = _SkyraRegex.Match(embed.Author.Url);
|
||||
return match.Success ? ulong.Parse(match.Groups[3].Value) : null;
|
||||
}
|
||||
|
||||
public class LoggerBot
|
||||
{
|
||||
public ulong Id;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ At the moment, log cleanup works with the following bots:
|
|||
- [Mantaro](https://mantaro.site/) (precise)
|
||||
- [Pancake](https://pancake.gg/) (fuzzy)
|
||||
- [SafetyAtLast](https://www.safetyatlast.net/) (fuzzy)
|
||||
- [Skyra](https://www.skyra.pw/) (precise)
|
||||
- [UnbelievaBoat](https://unbelievaboat.com/) (precise)
|
||||
- Vanessa (fuzzy)
|
||||
- [Vortex](https://github.com/jagrosh/Vortex/wiki) (fuzzy)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue