slightly less verbose logging

This commit is contained in:
sam 2024-10-29 21:32:33 +01:00
parent dce148b844
commit 8f154ce5ae
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
5 changed files with 4 additions and 23 deletions

View file

@ -88,18 +88,11 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
public async Task HandlePkMessageAsync(IMessageCreate msg)
{
_logger.Debug("Received PluralKit message");
await Task.Delay(500.Milliseconds());
_logger.Debug("Starting handling PluralKit message");
// Check if the content matches a Discord link--if not, it's not a log message (we already check if this is a PluralKit message earlier)
if (!LinkRegex().IsMatch(msg.Content))
{
_logger.Debug("PluralKit message is not a log message because content is not a link");
return;
}
// The first (only, I think always?) embed's footer must match the expected format
var firstEmbed = msg.Embeds.FirstOrDefault();
@ -108,12 +101,7 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
|| !firstEmbed.Footer.TryGet(out var footer)
|| !FooterRegex().IsMatch(footer.Text)
)
{
_logger.Debug(
"PK message is not a log message because there is no first embed or its footer doesn't match the regex"
);
return;
}
var match = FooterRegex().Match(footer.Text);