java.lang.Iterable<AuditLogEntry>public class AuditLogPaginationAction extends PaginationAction<AuditLogEntry,AuditLogPaginationAction>
PaginationAction
that paginates the endpoint Route.Guilds.GET_AUDIT_LOGS.
Must provide not-null Guild to compile a valid guild audit logs
pagination route
public class Listener extends ListenerAdapter
{
@Override
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().getAuditLogs();
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();
});
}
}
PaginationAction.PaginationIteratorRestAction.EmptyRestAction<T>DEFAULT_FAILURE, DEFAULT_SUCCESS, LOG| Constructor | Description |
|---|---|
AuditLogPaginationAction(Guild guild) |
| Modifier and Type | Method | Description |
|---|---|---|
Guild |
getGuild() |
The current target
Guild for
this AuditLogPaginationAction. |
AuditLogPaginationAction |
type(ActionType type) |
Filters retrieved entities by the specified
ActionType |
AuditLogPaginationAction |
user(long userId) |
Filters retrieved entities by the specified
User id. |
AuditLogPaginationAction |
user(java.lang.String userId) |
Filters retrieved entities by the specified
User id. |
AuditLogPaginationAction |
user(User user) |
Filters retrieved entities by the specified
User. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcache, cacheSize, forEachAsync, forEachAsync, forEachRemaining, forEachRemainingAsync, forEachRemainingAsync, getCached, getFirst, getLast, getLimit, getMaxLimit, getMinLimit, isCacheEnabled, isEmpty, iterator, limit, parallelStream, setCheck, spliterator, stream, takeAsync, takeRemainingAsynccomplete, complete, completeAfter, getJDA, isPassContext, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, setPassContext, submit, submit, submitAfter, submitAfterpublic AuditLogPaginationAction(Guild guild)
public AuditLogPaginationAction type(ActionType type)
ActionTypetype - ActionType used to filter,
or null to remove type filteringpublic AuditLogPaginationAction user(User user)
User.
user - User used to filter,
or null to remove user filteringpublic AuditLogPaginationAction user(java.lang.String userId)
User id.
userId - User id used to filter,
or null to remove user filteringjava.lang.IllegalArgumentException - If the provided userId is not validpublic AuditLogPaginationAction user(long userId)
User id.userId - User id used to filter,
or null to remove user filtering