Class VotingCheckingService<T extends VotePayload>

java.lang.Object
de.chojo.jdautil.botlist.modules.shared.RouteProvider
de.chojo.jdautil.botlist.modules.voting.poll.VotingCheckingService<T>
Type Parameters:
T - type of the response
All Implemented Interfaces:
VoteChecker

public class VotingCheckingService<T extends VotePayload> extends RouteProvider implements VoteChecker
Checks votes by calling a vote check endpoint of the bot list.

Answers are cached per list and user for one minute, so a busy bot stays below the rate limits of the lists. Failed requests and error responses count as "not voted" and are not cached.

  • Constructor Details

    • VotingCheckingService

      public VotingCheckingService(String route, Class<T> response)
      Creates a new vote checker.
      Parameters:
      route - route relative to the base url. {id} is replaced with the application id, {user} with the user id.
      response - type the response body is read into
  • Method Details

    • hasVoted

      public boolean hasVoted(BotList botList, User user)
      Description copied from interface: VoteChecker
      Checks whether the user has an active vote on the bot list.
      Specified by:
      hasVoted in interface VoteChecker
      Parameters:
      botList - bot list to ask
      user - user to check
      Returns:
      true when the user has an active vote