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 classPollingUpdateProvider.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.PollingUpdateProviderBuilderbuilder()java.util.List<UpdateType>getAllowedUpdates()java.util.Map<TelegramBot,java.lang.Thread>getBotThreads()longgetMaxUpdateAge()The max age (in seconds) that an update can be.intgetSleepInterval()intgetTimeout()java.util.function.Consumer<TelegramException>getUpdateErrorHandler()voidlistenFor(TelegramBot bot)Begin listening for updates for this botvoidstopListening(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:UpdateProviderBegin listening for updates for this bot- Specified by:
listenForin interfaceUpdateProvider- Parameters:
bot- The bot instance
-
stopListening
public void stopListening(TelegramBot bot)
Description copied from interface:UpdateProviderStop listening for updates for this bot- Specified by:
stopListeningin 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()
-
-