Package org.telegram.telegrambots.bots
Class DefaultAbsSender
- java.lang.Object
-
- org.telegram.telegrambots.meta.bots.AbsSender
-
- org.telegram.telegrambots.bots.DefaultAbsSender
-
- Direct Known Subclasses:
TelegramLongPollingBot,TelegramWebhookBot
public abstract class DefaultAbsSender extends AbsSender
- Version:
- 1.0 Implementation of all the methods needed to interact with Telegram Servers
- Author:
- Ruben Bermudez
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutorServiceexe
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultAbsSender(DefaultBotOptions options)
-
Method Summary
-
Methods inherited from class org.telegram.telegrambots.meta.bots.AbsSender
execute, executeAsync, executeAsync, getMe, getMeAsync, getMeAsync, getWebhookInfo, getWebhookInfoAsync, getWebhookInfoAsync
-
-
-
-
Field Detail
-
exe
protected final ExecutorService exe
-
-
Constructor Detail
-
DefaultAbsSender
protected DefaultAbsSender(DefaultBotOptions options)
-
-
Method Detail
-
getBotToken
public abstract String getBotToken()
Returns the token of the bot to be able to perform Telegram Api Requests- Returns:
- Token of the bot
-
getOptions
public final DefaultBotOptions getOptions()
-
getBaseUrl
public String getBaseUrl()
-
downloadFile
public final File downloadFile(String filePath) throws TelegramApiException
- Throws:
TelegramApiException
-
downloadFile
public final File downloadFile(File file) throws TelegramApiException
- Throws:
TelegramApiException
-
downloadFile
public final File downloadFile(File file, File outputFile) throws TelegramApiException
- Throws:
TelegramApiException
-
downloadFile
public final File downloadFile(String filePath, File outputFile) throws TelegramApiException
- Throws:
TelegramApiException
-
downloadFileAsync
public final void downloadFileAsync(String filePath, DownloadFileCallback<String> callback) throws TelegramApiException
- Throws:
TelegramApiException
-
downloadFileAsync
public final void downloadFileAsync(File file, DownloadFileCallback<File> callback) throws TelegramApiException
- Throws:
TelegramApiException
-
downloadFileAsStream
public final InputStream downloadFileAsStream(String filePath) throws TelegramApiException
- Throws:
TelegramApiException
-
downloadFileAsStream
public final InputStream downloadFileAsStream(File file) throws TelegramApiException
- Throws:
TelegramApiException
-
execute
public final Message execute(SendDocument sendDocument) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public final Message execute(SendPhoto sendPhoto) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public final Message execute(SendVideo sendVideo) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public final Message execute(SendVideoNote sendVideoNote) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public final Message execute(SendSticker sendSticker) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public final Message execute(SendAudio sendAudio) throws TelegramApiException
Sends a file using Send Audio method (https://core.telegram.org/bots/api#sendaudio)- Specified by:
executein classAbsSender- Parameters:
sendAudio- Information to send- Returns:
- If success, the sent Message is returned
- Throws:
TelegramApiException- If there is any error sending the audio
-
execute
public final Message execute(SendVoice sendVoice) throws TelegramApiException
Sends a voice note using Send Voice method (https://core.telegram.org/bots/api#sendvoice) For this to work, your audio must be in an .ogg file encoded with OPUS- Specified by:
executein classAbsSender- Parameters:
sendVoice- Information to send- Returns:
- If success, the sent Message is returned
- Throws:
TelegramApiException- If there is any error sending the audio
-
execute
public Boolean execute(SetChatPhoto setChatPhoto) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public List<Message> execute(SendMediaGroup sendMediaGroup) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public Boolean execute(AddStickerToSet addStickerToSet) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public Boolean execute(SetStickerSetThumb setStickerSetThumb) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public Boolean execute(CreateNewStickerSet createNewStickerSet) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public File execute(UploadStickerFile uploadStickerFile) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public Serializable execute(EditMessageMedia editMessageMedia) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
execute
public Message execute(SendAnimation sendAnimation) throws TelegramApiException
- Specified by:
executein classAbsSender- Throws:
TelegramApiException
-
executeAsync
public CompletableFuture<Message> executeAsync(SendDocument sendDocument)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Message> executeAsync(SendPhoto sendPhoto)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Message> executeAsync(SendVideo sendVideo)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Message> executeAsync(SendVideoNote sendVideoNote)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Message> executeAsync(SendSticker sendSticker)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Message> executeAsync(SendAudio sendAudio)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Message> executeAsync(SendVoice sendVoice)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<List<Message>> executeAsync(SendMediaGroup sendMediaGroup)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Boolean> executeAsync(SetChatPhoto setChatPhoto)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Boolean> executeAsync(AddStickerToSet addStickerToSet)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Boolean> executeAsync(SetStickerSetThumb setStickerSetThumb)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Boolean> executeAsync(CreateNewStickerSet createNewStickerSet)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<File> executeAsync(UploadStickerFile uploadStickerFile)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Serializable> executeAsync(EditMessageMedia editMessageMedia)
- Specified by:
executeAsyncin classAbsSender
-
executeAsync
public CompletableFuture<Message> executeAsync(SendAnimation sendAnimation)
- Specified by:
executeAsyncin classAbsSender
-
sendApiMethodAsync
protected final <T extends Serializable,Method extends BotApiMethod<T>,Callback extends SentCallback<T>> void sendApiMethodAsync(Method method, Callback callback)
- Specified by:
sendApiMethodAsyncin classAbsSender
-
sendApiMethodAsync
protected <T extends Serializable,Method extends BotApiMethod<T>> CompletableFuture<T> sendApiMethodAsync(Method method)
- Specified by:
sendApiMethodAsyncin classAbsSender
-
sendApiMethod
protected final <T extends Serializable,Method extends BotApiMethod<T>> T sendApiMethod(Method method) throws TelegramApiException
- Specified by:
sendApiMethodin classAbsSender- Throws:
TelegramApiException
-
-