Interface AuditLogPaginationAction

All Superinterfaces:
Iterable<AuditLogEntry>, PaginationAction<AuditLogEntry,AuditLogPaginationAction>, RestAction<@Unmodifiable List<AuditLogEntry>>

public interface AuditLogPaginationAction extends PaginationAction<AuditLogEntry,AuditLogPaginationAction>
PaginationAction that paginates the audit logs endpoint.
Note that this implementation is not considered thread-safe as modifications to the cache are not done with a lock. Calling methods on this class from multiple threads is not recommended.

Must provide not-null Guild to compile a valid guild audit logs pagination route

Minimum - 1
Maximum - 100


 public class Listener extends ListenerAdapter
     public void onRoleCreate(RoleCreateEvent event)
         List<TextChannel> channels = event.getGuild().getTextChannelsByName("logs", true);
         if (channels.isEmpty()) return; // no log channel
         TextChannel channel = channels.get(0); // get first match

         AuditLogPaginationAction auditLogs = event.getGuild().retrieveAuditLogs();
         auditLogs.type(ActionType.ROLE_CREATE); // only take ROLE_CREATE type
         auditLogs.limit(1); // take first
         auditLogs.queue( (entries) ->
             // callback has a list, this may be empty due to race conditions
             if (entries.isEmpty()) return;
             AuditLogEntry entry = entries.get(0);
             channel.sendMessageFormat("A role has been updated by %#s!", entry.getUser()).queue();
See Also: