Class TimedSendLongPollingBot
java.lang.Object
org.telegram.telegrambots.meta.bots.AbsSender
org.telegram.telegrambots.bots.DefaultAbsSender
org.telegram.telegrambots.bots.TelegramLongPollingBot
org.telegram.telegrambots.extensions.bots.timedbot.TimedSendLongPollingBot
- All Implemented Interfaces:
org.telegram.telegrambots.meta.generics.LongPollingBot,org.telegram.telegrambots.meta.generics.TelegramBot
Created by Daniil Nikanov aka JetCoder
-
Field Summary
Fields inherited from class org.telegram.telegrambots.bots.DefaultAbsSender
exe -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDeprecated.Overwriting the getBotToken() method is deprecated.protectedTimedSendLongPollingBot(String botToken) -
Method Summary
Modifier and TypeMethodDescriptionvoidfinish()abstract voidsendMessageCallback(Long chatId, Object messageRequest) //@Override public void sendMessageCallback(Long chatId, Object messageRequest) { try { if (messageRequest instanceof SendMessage) { sendMessage((SendMessage) messageRequest); } else if (messageRequest instanceof EditMessageText) { editMessageText((EditMessageText) messageRequest); } else if (messageRequest instanceof SendChatAction) { sendChatAction((SendChatAction) messageRequest); } else if (messageRequest instanceof SendDocument) { sendDocument((SendDocument) messageRequest); } //Etc...voidSendMessage sendMessageRequest = new SendMessage(); sendMessageRequest.setChatId(chatId); sendMessageRequest.setParseMode("HTML"); sendMessageRequest.setText(text); sendMessageRequest.setReplyMarkup(replyMarkup); sendTimed(chatId, sendMessageRequest); // <-- Instead of sendMessage() API methodMethods inherited from class org.telegram.telegrambots.bots.TelegramLongPollingBot
clearWebhook, onClosingMethods inherited from class org.telegram.telegrambots.bots.DefaultAbsSender
downloadFile, downloadFile, downloadFile, downloadFile, downloadFileAsStream, downloadFileAsStream, downloadFileAsync, downloadFileAsync, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, getBaseUrl, getBotToken, getOptions, sendApiMethod, sendApiMethodAsync, sendApiMethodAsyncMethods inherited from class org.telegram.telegrambots.meta.bots.AbsSender
execute, executeAsync, executeAsync, getMe, getMeAsync, getMeAsync, getWebhookInfo, getWebhookInfoAsync, getWebhookInfoAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.telegram.telegrambots.meta.generics.LongPollingBot
getOptions, onUpdateReceived, onUpdatesReceivedMethods inherited from interface org.telegram.telegrambots.meta.generics.TelegramBot
getBotToken, getBotUsername, onRegister
-
Constructor Details
-
TimedSendLongPollingBot
Deprecated.Overwriting the getBotToken() method is deprecated. Use the constructor instead -
TimedSendLongPollingBot
-
-
Method Details
-
finish
public void finish() -
sendTimed
SendMessage sendMessageRequest = new SendMessage(); sendMessageRequest.setChatId(chatId); sendMessageRequest.setParseMode("HTML"); sendMessageRequest.setText(text); sendMessageRequest.setReplyMarkup(replyMarkup); sendTimed(chatId, sendMessageRequest); // <-- Instead of sendMessage() API method -
sendMessageCallback
//@Override public void sendMessageCallback(Long chatId, Object messageRequest) { try { if (messageRequest instanceof SendMessage) { sendMessage((SendMessage) messageRequest); } else if (messageRequest instanceof EditMessageText) { editMessageText((EditMessageText) messageRequest); } else if (messageRequest instanceof SendChatAction) { sendChatAction((SendChatAction) messageRequest); } else if (messageRequest instanceof SendDocument) { sendDocument((SendDocument) messageRequest); } //Etc... } catch (TelegramApiException e) { LOG.error(EXC, e); } catch (Exception e) { LOG.fatal(EXC, e); } }
-