Interface AuditLogPaginationAction
-
- All Superinterfaces:
Iterable<AuditLogEntry>,PaginationAction<AuditLogEntry,AuditLogPaginationAction>,RestAction<List<AuditLogEntry>>
public interface AuditLogPaginationAction extends PaginationAction<AuditLogEntry,AuditLogPaginationAction>
PaginationActionthat paginates the endpointRoute.Guilds.GET_AUDIT_LOGS.
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
Guildto compile a valid guild audit logs pagination routeLimits
Minimum - 1
Maximum - 100Example
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().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(); }); } }- Since:
- 3.2
- See Also:
Guild.retrieveAuditLogs()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction
PaginationAction.PaginationIterator<E>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GuildgetGuild()The current targetGuildfor this AuditLogPaginationAction.AuditLogPaginationActiontype(ActionType type)Filters retrieved entities by the specifiedActionTypeAuditLogPaginationActionuser(long userId)Filters retrieved entities by the specifiedUserid.AuditLogPaginationActionuser(String userId)Filters retrieved entities by the specifiedUserid.AuditLogPaginationActionuser(User user)Filters retrieved entities by the specifiedUser.-
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction
cache, cacheSize, forEachAsync, forEachAsync, forEachRemaining, forEachRemainingAsync, forEachRemainingAsync, getCached, getFirst, getLast, getLastKey, getLimit, getMaxLimit, getMinLimit, isCacheEnabled, isEmpty, iterator, limit, parallelStream, setCheck, skipTo, spliterator, stream, takeAsync, takeRemainingAsync, takeUntilAsync, takeUntilAsync, takeWhileAsync, takeWhileAsync
-
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
complete, complete, completeAfter, getJDA, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter
-
-
-
-
Method Detail
-
getGuild
@Nonnull Guild getGuild()
The current targetGuildfor this AuditLogPaginationAction.- Returns:
- The never-null target Guild
-
type
@Nonnull AuditLogPaginationAction type(@Nullable ActionType type)
Filters retrieved entities by the specifiedActionType- Parameters:
type-ActionTypeused to filter, ornullto remove type filtering- Returns:
- The current AuditLogPaginationAction for chaining convenience
-
user
@Nonnull AuditLogPaginationAction user(@Nullable User user)
Filters retrieved entities by the specifiedUser.
This specified the action issuer and not the target of an action. (Targets need not be users)- Parameters:
user-Userused to filter, ornullto remove user filtering- Returns:
- The current AuditLogPaginationAction for chaining convenience
-
user
@Nonnull AuditLogPaginationAction user(@Nullable String userId)
Filters retrieved entities by the specifiedUserid.
This specified the action issuer and not the target of an action. (Targets need not be users)- Parameters:
userId-Userid used to filter, ornullto remove user filtering- Returns:
- The current AuditLogPaginationAction for chaining convenience
- Throws:
IllegalArgumentException- If the provided userId is not valid
-
user
@Nonnull AuditLogPaginationAction user(long userId)
Filters retrieved entities by the specifiedUserid.- Parameters:
userId-Userid used to filter, ornullto remove user filtering- Returns:
- The current AuditLogPaginationAction for chaining convenience
-
-