Interface ThreadChannelPaginationAction

All Superinterfaces:
Iterable<ThreadChannel>, PaginationAction<ThreadChannel,ThreadChannelPaginationAction>, RestAction<@Unmodifiable List<ThreadChannel>>

public interface ThreadChannelPaginationAction extends PaginationAction<ThreadChannel,ThreadChannelPaginationAction>
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 IThreadContainer to compile a valid pagination route.

Limits:
Minimum - 1
Maximum - 100

Example


 // 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();
         }
     );
 }
 
See Also: