Example #1
0
        async Task GuildUpdated(IGuild b, IGuild a)
        {
            var log = Logs.GetGuild(a);

            if (log == null)
            {
                return;
            }
            await LogChange(log, "Guild AFK Timeout", b, a, g => g.AFKTimeout);
            await LogChange(log, "Guild Icon", b, a, g => g.IconUrl);
            await LogChange(log, "Guild Default Message Notification", b, a, g => g.DefaultMessageNotifications);
            await LogChange(log, "Guild Embeddable State", b, a, g => g.IsEmbeddable);
            await LogChange(log, "Guild MFA Level", b, a, g => g.MfaLevel);
            await LogChange(log, "Guild Name", b, a, g => g.Name);
            await LogChange(log, "Guild Splash URL", b, a, g => g.SplashUrl);
            await LogChange(log, "Guild Verification Level", b, a, g => g.VerificationLevel);
            await LogChange(log, "Guild Voice Region ID", b, a, g => g.VoiceRegionId);
            await LogSetChange(log, "Guild Features", b, a, g => g.Features, f => f);
            await LogSetChange(log, "Guild Emojis", b, a, g => g.Emojis, e => e.Name);

            if (b.AFKChannelId != a.AFKChannelId)
            {
                IGuildChannel bAfk = null, aAfk = null;
                if (b.AFKChannelId.HasValue)
                {
                    bAfk = await a.GetChannelAsync(b.AFKChannelId.Value);
                }
                if (a.AFKChannelId.HasValue)
                {
                    aAfk = await a.GetChannelAsync(a.AFKChannelId.Value);
                }
                await log.LogEvent($"Guild AFK Channel changed: {bAfk.ToIDString()} => {aAfk.ToIDString()}");
            }
        }