fix: No embed found early return (sapphire bot log cleanup)

Co-authored-by: violet <167108906+avioletheart@users.noreply.github.com>
This commit is contained in:
institute 2024-11-08 01:58:12 +00:00 committed by GitHub
parent 36e8daf597
commit 0cc0ec935c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -249,6 +249,7 @@ public class LoggerCleanService
// Embed, Message title field: "Message deleted", description contains "**Message ID:** [[id]]"
// Example: "**Message ID:** [1297549791927996598]"
var embed = msg.Embeds?.FirstOrDefault();
if (embed == null) return null;
if (!(embed.Title?.StartsWith("Message deleted") ?? false)) return null;
var match = _sapphireRegex.Match(embed.Description);
return match.Success ? ulong.Parse(match.Groups[1].Value) : null;