Example #1
0
        private async Task <DiscordChannel> FindLogChannel(ulong guild, ulong channel)
        {
            var obj = await _rest.GetChannel(channel);

            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} 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 });
            }

            return(obj);
        }