com.pengrad.telegrambot.request.GetUpdates Java Examples

The following examples show how to use com.pengrad.telegrambot.request.GetUpdates. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BotController.java    From telegram-bot with Eclipse Public License 1.0 5 votes vote down vote up
@RequestMapping("/poll")
public void poll() {

	GetUpdates getUpdates = new GetUpdates().limit(100).offset(0).timeout(0);
	GetUpdatesResponse getUpdatesResponse = bot.execute(getUpdates);

	List<Update> updates = getUpdatesResponse.updates();
	updates.forEach(this::webhook);
}
 
Example #2
Source File: TelegramBot.java    From java-telegram-bot-api with Apache License 2.0 4 votes vote down vote up
public void setUpdatesListener(UpdatesListener listener) {
    setUpdatesListener(listener, new GetUpdates());
}
 
Example #3
Source File: TelegramBot.java    From java-telegram-bot-api with Apache License 2.0 4 votes vote down vote up
public void setUpdatesListener(UpdatesListener listener, GetUpdates request) {
    setUpdatesListener(listener, null, request);
}
 
Example #4
Source File: TelegramBot.java    From java-telegram-bot-api with Apache License 2.0 4 votes vote down vote up
public void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler) {
    setUpdatesListener(listener, exceptionHandler, new GetUpdates());
}
 
Example #5
Source File: TelegramBot.java    From java-telegram-bot-api with Apache License 2.0 4 votes vote down vote up
public void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler, GetUpdates request) {
    updatesHandler.start(this, listener, exceptionHandler, request);
}
 
Example #6
Source File: UpdatesHandler.java    From java-telegram-bot-api with Apache License 2.0 4 votes vote down vote up
public void start(TelegramBot bot, UpdatesListener listener, ExceptionHandler exceptionHandler, GetUpdates request) {
    this.bot = bot;
    this.listener = listener;
    this.exceptionHandler = exceptionHandler;
    getUpdates(request);
}