public static async Task <DiscordAuditLogEntry> GetLatestAuditLogEntryAsync(this DiscordGuild guild, AuditLogActionType type)
 {
     try {
         DiscordAuditLogEntry entry = (await guild.GetAuditLogsAsync(1, action_type: type))
                                      ?.FirstOrDefault();
         if (entry is null || DateTime.UtcNow - entry.CreationTimestamp.ToUniversalTime() > TimeSpan.FromSeconds(5))
         {
             return(null);
         }
         return(entry);
     } catch {
     }
     return(null);
 }
        private async Task UpdateAuditLogs(AuditLogActionType type, DiscordGuild guild)
        {
            DiscordAuditLogEntry entryLatest = (await guild.GetAuditLogsAsync(limit: 1, action_type: type))[0];
            DiscordEmbedBuilder  builder     = new DiscordEmbedBuilder();
            DiscordUser          responsible = entryLatest.UserResponsible;

            builder.WithAuthor(responsible.Username, null, responsible.AvatarUrl);

            switch (entryLatest.ActionCategory)
            {
            case AuditLogActionCategory.Create:
                builder.Color = DiscordColor.Green;
                break;

            case AuditLogActionCategory.Update:
                builder.Color = DiscordColor.Yellow;
                break;

            case AuditLogActionCategory.Delete:
                builder.Color = DiscordColor.Red;
                break;

            case AuditLogActionCategory.Other:
                builder.Color = DiscordColor.White;
                break;

            default:
                break;
            }

            switch (entryLatest.ActionType)
            {
            case AuditLogActionType.GuildUpdate:
                builder.WithTitle("Guild updated");
                break;

            case AuditLogActionType.ChannelCreate:
                builder.WithTitle("Channel created");
                break;

            case AuditLogActionType.ChannelUpdate:
                builder.WithTitle("Channel updated");
                break;

            case AuditLogActionType.ChannelDelete:
                builder.WithTitle("Channel deleted");
                break;

            case AuditLogActionType.OverwriteCreate:
                builder.WithTitle("Permission override for channel created");
                break;

            case AuditLogActionType.OverwriteUpdate:
                builder.WithTitle("Permission override for channel updated");
                break;

            case AuditLogActionType.OverwriteDelete:
                builder.WithTitle("Permission override for channel deleted");
                break;

            case AuditLogActionType.Kick:
                builder.WithTitle("User kicked");
                break;

            case AuditLogActionType.Prune:
                builder.WithTitle("Users pruned");
                break;

            case AuditLogActionType.Ban:
                builder.WithTitle("User banned");
                break;

            case AuditLogActionType.Unban:
                builder.WithTitle("User unbanned");
                break;

            case AuditLogActionType.MemberUpdate:
                builder.WithTitle("Member updated");
                break;

            case AuditLogActionType.MemberRoleUpdate:
                builder.WithTitle("Member role updated");
                break;

            case AuditLogActionType.RoleCreate:
                builder.WithTitle("Role created");
                break;

            case AuditLogActionType.RoleUpdate:
                builder.WithTitle("Role updated");
                break;

            case AuditLogActionType.RoleDelete:
                builder.WithTitle("Role deleted");
                break;

            case AuditLogActionType.InviteCreate:
                builder.WithTitle("Invite created");
                break;

            case AuditLogActionType.InviteUpdate:
                builder.WithTitle("Invite updated");
                break;

            case AuditLogActionType.InviteDelete:
                builder.WithTitle("Invite deleted");
                break;

            case AuditLogActionType.WebhookCreate:
                builder.WithTitle("Webhook created");
                break;

            case AuditLogActionType.WebhookUpdate:
                builder.WithTitle("Webhook updated");
                break;

            case AuditLogActionType.WebhookDelete:
                builder.WithTitle("Webhook deleted");
                break;

            case AuditLogActionType.EmojiCreate:
                builder.WithTitle("Emoji created");
                break;

            case AuditLogActionType.EmojiUpdate:
                builder.WithTitle("Emoji updated");
                break;

            case AuditLogActionType.EmojiDelete:
                builder.WithTitle("Emoji deleted");
                break;

            case AuditLogActionType.MessageDelete:
                builder.WithTitle("Message deleted (See logs channel for more info)");
                break;

            default:
                builder.WithTitle("Unknown event");
                break;
            }

            Type entryType = entryLatest.GetType();

            PropertyInfo[] properties = entryType.GetProperties();

            foreach (PropertyInfo prop in properties)
            {
                if (typeof(PropertyChange <>).IsAssignableFrom(prop.PropertyType))
                {
                    Type changeType = prop.PropertyType.GetGenericArguments()[0];
                }
                else
                {
                }
            }
        }