From bed43379cff6814a83ddc997728edd99e87f8cce Mon Sep 17 00:00:00 2001 From: Ske Date: Wed, 12 Aug 2020 21:32:39 +0200 Subject: [PATCH] Add additional (debug) logging to (proxy) logger --- PluralKit.Bot/Services/LogChannelService.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PluralKit.Bot/Services/LogChannelService.cs b/PluralKit.Bot/Services/LogChannelService.cs index c75ebb48..e840e89b 100644 --- a/PluralKit.Bot/Services/LogChannelService.cs +++ b/PluralKit.Bot/Services/LogChannelService.cs @@ -37,8 +37,14 @@ namespace PluralKit.Bot { if (logChannel == null || logChannel.Type != ChannelType.Text) return; // Check bot permissions - if (!trigger.Channel.BotHasAllPermissions(Permissions.SendMessages | Permissions.EmbedLinks)) return; - + if (!trigger.Channel.BotHasAllPermissions(Permissions.SendMessages | Permissions.EmbedLinks)) + { + _logger.Information( + "Does not have permission to proxy log, ignoring (channel: {ChannelId}, guild: {GuildId}, bot permissions: {BotPermissions})", + ctx.LogChannel.Value, trigger.Channel.GuildId, trigger.Channel.BotPermissions()); + return; + } + // Send embed! await using var conn = await _db.Obtain(); var embed = _embed.CreateLoggedMessageEmbed(await conn.QuerySystem(ctx.SystemId.Value), @@ -55,7 +61,7 @@ namespace PluralKit.Bot { if (obj == null) { // Channel doesn't exist or we don't have permission to access it, let's remove it from the database too - _logger.Warning("Attempted to fetch missing log channel {LogChannel}, removing from database", channel); + _logger.Warning("Attempted to fetch missing log channel {LogChannel} for guild {Guild}, removing from database", channel, guild); await using var conn = await _db.Obtain(); await conn.ExecuteAsync("update servers set log_channel = null where id = @Guild", new {Guild = guild});