public class SendPoll extends AbstractBaseRequest<SendPoll,Message>
SendPoll class. Returns sent Message on success.
Since:
3 March 2025
See Also:
  • Constructor Details

    • SendPoll

      public SendPoll(Object chatId, String question, InputPollOption[] options, Api api)
      Required
      Parameters:
      chatId - chat id
      question - question
      options - options
      api - api
  • Method Details

    • isAnonymous

      public SendPoll isAnonymous(boolean isAnonymous)
      Optional
      Parameters:
      isAnonymous - True, if the poll needs to be anonymous, defaults to True
      Returns:
      SendPoll
    • type

      public SendPoll type(PollType type)
      Optional
      Parameters:
      type - Poll type, PollType.QUIZ or PollType.REGULAR, defaults to PollType.REGULAR
      Returns:
      SendPoll
    • allowsMultipleAnswers

      public SendPoll allowsMultipleAnswers(boolean allowsMultipleAnswers)
      Optional
      Parameters:
      allowsMultipleAnswers - True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
      Returns:
      SendPoll
    • correctOptionId

      public SendPoll correctOptionId(int correctOptionId)
      Optional
      Parameters:
      correctOptionId - 0-based identifier of the correct answer option, required for polls in quiz mode
      Returns:
      SendPoll
    • explanation

      public SendPoll explanation(String explanation)
      Optional
      Parameters:
      explanation - Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
      Returns:
      SendPoll
    • explanationParseMode

      public SendPoll explanationParseMode(ParseMode explanationParseMode)
      Optional
      Parameters:
      explanationParseMode - Mode for parsing entities in the explanation.
      Returns:
      SendPoll
    • explanationEntities

      public SendPoll explanationEntities(MessageEntity[] explanationEntities)
      Optional
      Parameters:
      explanationEntities - A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode
      Returns:
      SendPoll
    • openPeriod

      public SendPoll openPeriod(int openPeriod)
      Optional
      Parameters:
      openPeriod - Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
      Returns:
      SendPoll
    • closeDate

      public SendPoll closeDate(int closeDate)
      Optional
      Parameters:
      closeDate - Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
      Returns:
      SendPoll
    • isClosed

      public SendPoll isClosed(boolean isClosed)
      Optional
      Parameters:
      isClosed - Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
      Returns:
      SendPoll
    • disableNotification

      public SendPoll disableNotification(boolean disableNotification)
      Optional
      Parameters:
      disableNotification - Sends the message silently. Users will receive a notification with no sound.
      Returns:
      SendPoll
    • protectContent

      public SendPoll protectContent(boolean protectContent)
      Optional
      Parameters:
      protectContent - Protects the contents of the sent message from forwarding and saving
      Returns:
      SendPoll
    • allowPaidBroadcast

      public SendPoll allowPaidBroadcast(boolean allowPaidBroadcast)
      Optional
      Parameters:
      allowPaidBroadcast - Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
      Returns:
      SendPoll
    • replyParameters

      public SendPoll replyParameters(ReplyParameters replyParameters)
      Optional
      Parameters:
      replyParameters - Description of the message to reply to
      Returns:
      SendPoll
    • replyMarkup

      public SendPoll replyMarkup(Markup replyMarkup)
      Optional
      Parameters:
      replyMarkup - Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
      Returns:
      SendPoll
    • businessConnectionId

      public SendPoll businessConnectionId(String businessConnectionId)
      Optional
      Parameters:
      businessConnectionId - Unique identifier of the business connection on behalf of which the message will be sent
      Returns:
      SendPoll
    • questionParseMode

      public SendPoll questionParseMode(ParseMode questionParseMode)
      Optional
      Parameters:
      questionParseMode - Mode for parsing entities in the question.
      Returns:
      SendPoll
    • questionEntities

      public SendPoll questionEntities(MessageEntity[] questionEntities)
      Optional
      Parameters:
      questionEntities - A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode
      Returns:
      SendPoll
    • messageEffectId

      public SendPoll messageEffectId(String messageEffectId)
      Optional
      Parameters:
      messageEffectId - Unique identifier of the message effect to be added to the message; for private chats only
      Returns:
      SendPoll