Interface ThreadMemberPaginationAction
- All Superinterfaces:
Iterable<ThreadMember>
,PaginationAction<ThreadMember,
,ThreadMemberPaginationAction> RestAction<@Unmodifiable List<ThreadMember>>
public interface ThreadMemberPaginationAction
extends PaginationAction<ThreadMember,ThreadMemberPaginationAction>
PaginationAction
that 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 ThreadChannel
to compile a valid
pagination route.
Limits:
Minimum - 1
Maximum - 100
Example
// Count all thread members who are bots
public static CompletableFuture<AtomicInteger> countBotMembers(ThreadChannel thread) {
AtomicInteger count = new AtomicInteger();
ThreadMemberPaginationAction members = thread.retrieveThreadMembers();
return members.forEachAsync((threadMember) -> {
if (threadMember.getUser().isBot())
count.incrementAndGet();
return true; // continues iterating if this returns true
}).thenApply((v) -> count);
}
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction
PaginationAction.PaginationIterator<E>, PaginationAction.PaginationOrder
-
Method Summary
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, getOrder, getSupportedOrders, isCacheEnabled, isEmpty, iterator, limit, order, parallelStream, reverse, 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, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Method Details
-
getThreadChannel
TheThreadChannel
this action fetches members for.- Returns:
- The channel
-