@Test public void sendPoll() { String question = "Question ?"; String[] answers = {"Answer 1", "Answer 2"}; SendResponse sendResponse = bot.execute( new SendPoll(groupId, question, answers) .isAnonymous(false) .type(Poll.Type.quiz) .allowsMultipleAnswers(false) .correctOptionId(1) .isClosed(false) .explanation("Some __explanation__ of poll") .explanationParseMode(ParseMode.MarkdownV2) .openPeriod(500) ); Poll poll = sendResponse.message().poll(); assertFalse(poll.id().isEmpty()); assertEquals(question, poll.question()); assertEquals(answers.length, poll.options().length); for (int i = 0; i < answers.length; i++) { PollOption option = poll.options()[i]; assertEquals(answers[i], option.text()); assertEquals(Integer.valueOf(0), option.voterCount()); } assertFalse(poll.isAnonymous()); assertEquals(poll.type(), Poll.Type.quiz); assertFalse(poll.allowsMultipleAnswers()); assertEquals(poll.totalVoterCount(), Integer.valueOf(0)); assertEquals(poll.correctOptionId(), Integer.valueOf(1)); assertFalse(poll.isClosed()); assertEquals("Some explanation of poll", poll.explanation()); assertEquals(1, poll.explanationEntities().length); assertEquals(MessageEntity.Type.underline, poll.explanationEntities()[0].type()); assertTrue(poll.openPeriod() >= 495 && poll.openPeriod() <= 500); }
public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } TelegramBot(String botToken);   TelegramBot(Builder builder); }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } TelegramBot(String botToken);   TelegramBot(Builder builder); R execute(BaseRequest<T, R> request); void execute(T request, Callback<T, R> callback); String getFullFilePath(File file); byte[] getFileContent(File file); void setUpdatesListener(UpdatesListener listener); void setUpdatesListener(UpdatesListener listener, GetUpdates request); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler, GetUpdates request); void removeGetUpdatesListener(); }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } TelegramBot(String botToken);   TelegramBot(Builder builder); R execute(BaseRequest<T, R> request); void execute(T request, Callback<T, R> callback); String getFullFilePath(File file); byte[] getFileContent(File file); void setUpdatesListener(UpdatesListener listener); void setUpdatesListener(UpdatesListener listener, GetUpdates request); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler, GetUpdates request); void removeGetUpdatesListener();  }