public class RegistrableTelegramBot extends TelegramBot
Modifier and Type | Class and Description |
---|---|
static interface |
RegistrableTelegramBot.MessageListener |
Constructor and Description |
---|
RegistrableTelegramBot(String botToken) |
RegistrableTelegramBot(String botToken,
boolean async) |
Modifier and Type | Method and Description |
---|---|
protected void |
notifyNewMessages(List<Message> messages)
This method is called by this class to process all new
Message s asynchronously. |
protected ExecutorService |
provideExecutorService()
Instantiates and returns an
ExecutorService . |
void |
register(RegistrableTelegramBot.MessageListener messageListener) |
void |
unregister(RegistrableTelegramBot.MessageListener messageListener) |
forwardMessage, getMe, getUserProfilePhotos, getUserProfilePhotos, onMessage, onStart, onStop, replyTo, sendAudio, sendAudio, sendAudio, sendAudio, sendChatAction, sendDocument, sendDocument, sendDocument, sendDocument, sendLocation, sendLocation, sendMessage, sendMessage, sendPhoto, sendPhoto, sendPhoto, sendPhoto, sendSticker, sendSticker, sendSticker, sendSticker, sendVideo, sendVideo, sendVideo, sendVideo, sendVoice, sendVoice, sendVoice, sendVoice, start, stop
public RegistrableTelegramBot(String botToken)
public RegistrableTelegramBot(String botToken, boolean async)
public void register(RegistrableTelegramBot.MessageListener messageListener)
public void unregister(RegistrableTelegramBot.MessageListener messageListener)
protected ExecutorService provideExecutorService()
TelegramBot
ExecutorService
.
By default, Executors.newCachedThreadPool()
is used.
This method can safely be overridden to adjust this behaviour.
This method can safely be overridden to return null, but if you decide to do so, TelegramBot.notifyNewMessages(List)
must be overridden to avoid a NPE.provideExecutorService
in class TelegramBot
ExecutorService
protected void notifyNewMessages(List<Message> messages)
TelegramBot
Message
s asynchronously.
It must be overridden if TelegramBot.provideExecutorService()
is overridden to return null, otherwise
a NullPointerException
may be thrown.notifyNewMessages
in class TelegramBot
messages
- The newly arrived Message
s