Package com.jtelegram.api.update
Class PollingUpdateProvider
- java.lang.Object
-
- com.jtelegram.api.update.PollingUpdateProvider
-
- All Implemented Interfaces:
UpdateProvider
public class PollingUpdateProvider extends java.lang.Object implements UpdateProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PollingUpdateProvider.PollingUpdateProviderBuilder
-
Constructor Summary
Constructors Constructor Description PollingUpdateProvider()
PollingUpdateProvider(int sleepInterval, int timeout, long maxUpdateAge, java.util.List<UpdateType> allowedUpdates, java.util.function.Consumer<TelegramException> updateErrorHandler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PollingUpdateProvider.PollingUpdateProviderBuilder
builder()
java.util.List<UpdateType>
getAllowedUpdates()
java.util.Map<TelegramBot,java.lang.Thread>
getBotThreads()
long
getMaxUpdateAge()
The max age (in seconds) that an update can be.int
getSleepInterval()
int
getTimeout()
java.util.function.Consumer<TelegramException>
getUpdateErrorHandler()
void
listenFor(TelegramBot bot)
Begin listening for updates for this botvoid
stopListening(TelegramBot bot)
Stop listening for updates for this bot
-
-
-
Constructor Detail
-
PollingUpdateProvider
public PollingUpdateProvider(int sleepInterval, int timeout, long maxUpdateAge, java.util.List<UpdateType> allowedUpdates, java.util.function.Consumer<TelegramException> updateErrorHandler)
-
PollingUpdateProvider
public PollingUpdateProvider()
-
-
Method Detail
-
listenFor
public void listenFor(TelegramBot bot)
Description copied from interface:UpdateProvider
Begin listening for updates for this bot- Specified by:
listenFor
in interfaceUpdateProvider
- Parameters:
bot
- The bot instance
-
stopListening
public void stopListening(TelegramBot bot)
Description copied from interface:UpdateProvider
Stop listening for updates for this bot- Specified by:
stopListening
in interfaceUpdateProvider
- Parameters:
bot
- The bot instance
-
builder
public static PollingUpdateProvider.PollingUpdateProviderBuilder builder()
-
getBotThreads
public java.util.Map<TelegramBot,java.lang.Thread> getBotThreads()
-
getSleepInterval
public int getSleepInterval()
-
getTimeout
public int getTimeout()
-
getMaxUpdateAge
public long getMaxUpdateAge()
The max age (in seconds) that an update can be. If the data is available and the update is older than maxUpdateAge seconds, then it is silently ignored. By default, this feature is disabled.- See Also:
Update.TimeSensitiveUpdate
-
getAllowedUpdates
public java.util.List<UpdateType> getAllowedUpdates()
-
getUpdateErrorHandler
public java.util.function.Consumer<TelegramException> getUpdateErrorHandler()
-
-