Interface ThreadChannelPaginationAction
-
- All Superinterfaces:
Iterable<ThreadChannel>,PaginationAction<ThreadChannel,ThreadChannelPaginationAction>,RestAction<List<ThreadChannel>>
public interface ThreadChannelPaginationAction extends PaginationAction<ThreadChannel,ThreadChannelPaginationAction>
PaginationActionthat paginates the thread members 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
IThreadContainerto compile a valid pagination route.Limits:
Minimum - 1
Maximum - 100Example
// Clean up all private threads older than 2 weeks public static void cleanupPrivateThreads(TextChannel channel) { // get 2-week offset long 2WeekAgoTimestamp = System.currentTimeMillis() - (14 * 24 * 60 * 60 * 1000); // get paginator ThreadChannelPaginationAction threads = channel.retrieveArchivedPrivateThreadChannels(); // remove each thread older than 2 weeks threads.forEachAsync((thread) -> long threadArchiveTimestamp = thread.getTimeArchiveInfoLastModified().toInstant().toEpochMilli(); if (threadArchiveTimestamp < 2WeeksAgoTimestamp) { thread.delete().reason("Cleaning up old private threads").queue(); } ); }
-
-
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 Default Methods Modifier and Type Method Description IThreadContainergetChannel()default GuildgetGuild()The current targetGuildfor this ThreadChannelPaginationAction.-
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction
cache, cacheSize, deadline, 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, timeout
-
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
-
-
-
Method Detail
-
getChannel
@Nonnull IThreadContainer getChannel()
-
-