Interface BanPaginationAction

All Superinterfaces:
Iterable<Guild.Ban>, PaginationAction<Guild.Ban, BanPaginationAction>, RestAction<List<Guild.Ban>>

public interface BanPaginationAction extends PaginationAction<Guild.Ban, BanPaginationAction>
PaginationAction that paginates the guild bans 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 Guild to compile a valid pagination route.

Limits:
Minimum - 1
Maximum - 1000

Example

// Revoke all bans from a guild with a certain reason
public static void findBansWithReason(Guild guild, String reason) {
    BanPaginationAction bans = guild.retrieveBanList();
    bans.forEachAsync((ban) -> {
        if (reason.equals(ban.getReason())) {
            guild.unban(ban.getUser()).queue();
        }
        return true; // continues iterating if this returns true
    });
}
See Also:
  • Method Details

    • getGuild

      @Nonnull Guild getGuild()
      The current target Guild for this BanPaginationAction.
      Returns:
      The never-null target Guild