slightly less verbose logging
This commit is contained in:
parent
dce148b844
commit
8f154ce5ae
5 changed files with 4 additions and 23 deletions
|
|
@ -14,4 +14,7 @@ resharper_entity_framework_model_validation_unlimited_string_length_highlighting
|
||||||
# This is raised for every single property of records returned by endpoints
|
# This is raised for every single property of records returned by endpoints
|
||||||
resharper_not_accessed_positional_property_local_highlighting = none
|
resharper_not_accessed_positional_property_local_highlighting = none
|
||||||
# ReSharper yells at us for the name "GuildCache", for some reason
|
# ReSharper yells at us for the name "GuildCache", for some reason
|
||||||
resharper_inconsistent_naming_highlighting = none
|
resharper_inconsistent_naming_highlighting = none
|
||||||
|
# From the docs: "You might consider excluding [FirstOrDefault or LastOrDefault] if readability is a concern,
|
||||||
|
# since the code you'd write to replace them is not easily readable."
|
||||||
|
dotnet_code_quality.CA1826.exclude_ordefault_methods = true
|
||||||
|
|
@ -142,11 +142,6 @@ public class IgnoreChannelCommands(
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var ch in ignoredChannels)
|
|
||||||
{
|
|
||||||
_logger.Debug("Channel: {ChannelId}, type: {Type}", ch.Id, ch.Type);
|
|
||||||
}
|
|
||||||
|
|
||||||
var embed = new EmbedBuilder()
|
var embed = new EmbedBuilder()
|
||||||
.WithTitle($"Ignored channels in {guild.Name}")
|
.WithTitle($"Ignored channels in {guild.Name}")
|
||||||
.WithColour(DiscordUtils.Purple);
|
.WithColour(DiscordUtils.Purple);
|
||||||
|
|
|
||||||
|
|
@ -88,18 +88,11 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
|
||||||
|
|
||||||
public async Task HandlePkMessageAsync(IMessageCreate msg)
|
public async Task HandlePkMessageAsync(IMessageCreate msg)
|
||||||
{
|
{
|
||||||
_logger.Debug("Received PluralKit message");
|
|
||||||
|
|
||||||
await Task.Delay(500.Milliseconds());
|
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)
|
// 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))
|
if (!LinkRegex().IsMatch(msg.Content))
|
||||||
{
|
|
||||||
_logger.Debug("PluralKit message is not a log message because content is not a link");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// The first (only, I think always?) embed's footer must match the expected format
|
// The first (only, I think always?) embed's footer must match the expected format
|
||||||
var firstEmbed = msg.Embeds.FirstOrDefault();
|
var firstEmbed = msg.Embeds.FirstOrDefault();
|
||||||
|
|
@ -108,12 +101,7 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
|
||||||
|| !firstEmbed.Footer.TryGet(out var footer)
|
|| !firstEmbed.Footer.TryGet(out var footer)
|
||||||
|| !FooterRegex().IsMatch(footer.Text)
|
|| !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;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
var match = FooterRegex().Match(footer.Text);
|
var match = FooterRegex().Match(footer.Text);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,7 @@ public class MessageUpdateResponder(
|
||||||
var guildConfig = await guildRepository.GetAsync(msg.GuildID);
|
var guildConfig = await guildRepository.GetAsync(msg.GuildID);
|
||||||
|
|
||||||
if (await messageRepository.IsMessageIgnoredAsync(msg.ID.Value))
|
if (await messageRepository.IsMessageIgnoredAsync(msg.ID.Value))
|
||||||
{
|
|
||||||
_logger.Debug("Message {MessageId} should be ignored", msg.ID);
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ public class WebhookExecutorService(
|
||||||
public void QueueLog(Guild guildConfig, LogChannelType logChannelType, IEmbed embed)
|
public void QueueLog(Guild guildConfig, LogChannelType logChannelType, IEmbed embed)
|
||||||
{
|
{
|
||||||
var logChannel = GetLogChannel(guildConfig, logChannelType, channelId: null, userId: null);
|
var logChannel = GetLogChannel(guildConfig, logChannelType, channelId: null, userId: null);
|
||||||
_logger.Debug("Channel to log {Type} to: {LogChannel}", logChannelType, logChannel);
|
|
||||||
if (logChannel == null)
|
if (logChannel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -73,7 +72,6 @@ public class WebhookExecutorService(
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void QueueLog(ulong channelId, IEmbed embed)
|
public void QueueLog(ulong channelId, IEmbed embed)
|
||||||
{
|
{
|
||||||
_logger.Debug("Channel to log to: {LogChannel}", channelId);
|
|
||||||
if (channelId == 0)
|
if (channelId == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue