Update version 3.2

This commit is contained in:
Ruben Bermudez 2017-07-21 16:17:48 +02:00
parent 8183b77fce
commit ffcdbd126e
28 changed files with 1255 additions and 141 deletions

View File

@ -27,16 +27,16 @@ Just import add the library to your project with one of these options:
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>3.1.2</version> <version>3.2</version>
</dependency> </dependency>
``` ```
```gradle ```gradle
compile "org.telegram:telegrambots:3.1.2" compile "org.telegram:telegrambots:3.2"
``` ```
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/3.1.2) 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/3.2)
3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v3.1.2) 3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v3.2)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`. In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

View File

@ -83,3 +83,14 @@
### <a id="3.1.2"></a>3.1.2 ### ### <a id="3.1.2"></a>3.1.2 ###
1. Fix bug #266 1. Fix bug #266
### <a id="3.2"></a>3.2 ###
1. Support for Api Version [3.2](https://core.telegram.org/bots/api-changelog#july-21-2017)
2. Deprecated all redundant methods in AbsSender, will be removed in next major release
3. New Abstract methods `addStickerToSet`, `createNewStickerSet` and `uploadStickerFile` in AbsSender.
4. Abilities module
5. Removed deprecated methods from previous versions
6. Bug fixing: #257, #270
7. Simplify code from DefaultAbsSender: #272
**[[How to update to version 3.2|How-To-Update#3.2]]**

View File

@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>3.1.2</version> <version>3.2</version>
</dependency> </dependency>
``` ```
* With **Gradle**: * With **Gradle**:
```groovy ```groovy
compile group: 'org.telegram', name: 'telegrambots', version: '3.1.2' compile group: 'org.telegram', name: 'telegrambots', version: '3.2'
``` ```
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots). 2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).

View File

@ -28,3 +28,8 @@
### <a id="3.0.2"></a>To version 3.0.2 ### ### <a id="3.0.2"></a>To version 3.0.2 ###
1. If you were using `TelegramLongPollingCommandBot`, add the new [extensions dependency](https://github.com/rubenlagus/TelegramBots/tree/master/telegrambots-extensions) to your maven and fix import statements in your project. 1. If you were using `TelegramLongPollingCommandBot`, add the new [extensions dependency](https://github.com/rubenlagus/TelegramBots/tree/master/telegrambots-extensions) to your maven and fix import statements in your project.
2. If you were using `TelegramLongPollingCommandBot`, make sure you start using constructors with username and prevent overriding `getUsername` method. 2. If you were using `TelegramLongPollingCommandBot`, make sure you start using constructors with username and prevent overriding `getUsername` method.
### <a id="3.2"></a>To version 3.2 ###
1. Replace usage of all deprecated methods from AbsSender with methods `execute` or `executeAsync`.
2. If you are extending AbsSender class, implement new added methods.

View File

@ -7,7 +7,7 @@
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>Bots</artifactId> <artifactId>Bots</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.1.2</version> <version>3.2</version>
<modules> <modules>
<module>telegrambots</module> <module>telegrambots</module>
@ -26,6 +26,6 @@
<properties> <properties>
<maven.deploy.skip>true</maven.deploy.skip> <maven.deploy.skip>true</maven.deploy.skip>
<bots.version>3.1.2</bots.version> <bots.version>3.2</bots.version>
</properties> </properties>
</project> </project>

View File

@ -18,19 +18,19 @@ Usage
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId> <artifactId>telegrambots-abilities</artifactId>
<version>3.1.1</version> <version>3.2</version>
</dependency> </dependency>
``` ```
**Gradle** **Gradle**
```gradle ```gradle
compile "org.telegram:telegrambots-abilities:3.1.1" compile "org.telegram:telegrambots-abilities:3.2"
``` ```
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v3.1.1) **JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v3.2)
**Plain imports** - [Jar](https://github.com/addo37/AbilityBots/releases/download/v1.2.5/AbilityBots-1.2.5.jar) | [fatJar](https://github.com/addo37/AbilityBots/releases/download/v1.2.5/AbilityBots-with-dependencies-1.2.5.jar) **Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v3.2)
Motivation Motivation
---------- ----------

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId> <artifactId>telegrambots-abilities</artifactId>
<version>3.1.2</version> <version>3.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Telegram Ability Bot</name> <name>Telegram Ability Bot</name>
@ -35,6 +35,12 @@
<url>https://github.com/addo37</url> <url>https://github.com/addo37</url>
<id>addo37</id> <id>addo37</id>
</developer> </developer>
<developer>
<email>rberlopez@gmail.com</email>
<name>Ruben Bermudez</name>
<url>https://github.com/rubenlagus</url>
<id>rubenlagus</id>
</developer>
</developers> </developers>
<licenses> <licenses>
@ -59,7 +65,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>3.1.2</bots.version> <bots.version>3.2</bots.version>
<commonslang.version>3.5</commonslang.version> <commonslang.version>3.5</commonslang.version>
<mapdb.version>3.0.4</mapdb.version> <mapdb.version>3.0.4</mapdb.version>
<guava.version>19.0</guava.version> <guava.version>19.0</guava.version>

View File

@ -46,6 +46,7 @@ public final class Ability {
private final List<Reply> replies; private final List<Reply> replies;
private final List<Predicate<Update>> flags; private final List<Predicate<Update>> flags;
@SafeVarargs
private Ability(String name, String info, Locality locality, Privacy privacy, int argNum, Consumer<MessageContext> action, Consumer<MessageContext> postAction, List<Reply> replies, Predicate<Update>... flags) { private Ability(String name, String info, Locality locality, Privacy privacy, int argNum, Consumer<MessageContext> action, Consumer<MessageContext> postAction, List<Reply> replies, Predicate<Update>... flags) {
checkArgument(!isEmpty(name), "Method name cannot be empty"); checkArgument(!isEmpty(name), "Method name cannot be empty");
checkArgument(!containsWhitespace(name), "Method name cannot contain spaces"); checkArgument(!containsWhitespace(name), "Method name cannot contain spaces");

View File

@ -27,6 +27,7 @@ public final class Reply {
this.action = action; this.action = action;
} }
@SafeVarargs
public static Reply of(Consumer<Update> action, Predicate<Update>... conditions) { public static Reply of(Consumer<Update> action, Predicate<Update>... conditions) {
return new Reply(asList(conditions), action); return new Reply(asList(conditions), action);
} }

View File

@ -70,67 +70,67 @@ public class DefaultMessageSender implements MessageSender {
@Override @Override
public Boolean answerInlineQuery(AnswerInlineQuery answerInlineQuery) throws TelegramApiException { public Boolean answerInlineQuery(AnswerInlineQuery answerInlineQuery) throws TelegramApiException {
return bot.answerInlineQuery(answerInlineQuery); return bot.execute(answerInlineQuery);
} }
@Override @Override
public Boolean sendChatAction(SendChatAction sendChatAction) throws TelegramApiException { public Boolean sendChatAction(SendChatAction sendChatAction) throws TelegramApiException {
return bot.sendChatAction(sendChatAction); return bot.execute(sendChatAction);
} }
@Override @Override
public Message forwardMessage(ForwardMessage forwardMessage) throws TelegramApiException { public Message forwardMessage(ForwardMessage forwardMessage) throws TelegramApiException {
return bot.forwardMessage(forwardMessage); return bot.execute(forwardMessage);
} }
@Override @Override
public Message sendLocation(SendLocation sendLocation) throws TelegramApiException { public Message sendLocation(SendLocation sendLocation) throws TelegramApiException {
return bot.sendLocation(sendLocation); return bot.execute(sendLocation);
} }
@Override @Override
public Message sendVenue(SendVenue sendVenue) throws TelegramApiException { public Message sendVenue(SendVenue sendVenue) throws TelegramApiException {
return bot.sendVenue(sendVenue); return bot.execute(sendVenue);
} }
@Override @Override
public Message sendContact(SendContact sendContact) throws TelegramApiException { public Message sendContact(SendContact sendContact) throws TelegramApiException {
return bot.sendContact(sendContact); return bot.execute(sendContact);
} }
@Override @Override
public Boolean kickMember(KickChatMember kickChatMember) throws TelegramApiException { public Boolean kickMember(KickChatMember kickChatMember) throws TelegramApiException {
return bot.kickMember(kickChatMember); return bot.execute(kickChatMember);
} }
@Override @Override
public Boolean unbanMember(UnbanChatMember unbanChatMember) throws TelegramApiException { public Boolean unbanMember(UnbanChatMember unbanChatMember) throws TelegramApiException {
return bot.unbanMember(unbanChatMember); return bot.execute(unbanChatMember);
} }
@Override @Override
public Boolean leaveChat(LeaveChat leaveChat) throws TelegramApiException { public Boolean leaveChat(LeaveChat leaveChat) throws TelegramApiException {
return bot.leaveChat(leaveChat); return bot.execute(leaveChat);
} }
@Override @Override
public Chat getChat(GetChat getChat) throws TelegramApiException { public Chat getChat(GetChat getChat) throws TelegramApiException {
return bot.getChat(getChat); return bot.execute(getChat);
} }
@Override @Override
public List<ChatMember> getChatAdministrators(GetChatAdministrators getChatAdministrators) throws TelegramApiException { public List<ChatMember> getChatAdministrators(GetChatAdministrators getChatAdministrators) throws TelegramApiException {
return bot.getChatAdministrators(getChatAdministrators); return bot.execute(getChatAdministrators);
} }
@Override @Override
public ChatMember getChatMember(GetChatMember getChatMember) throws TelegramApiException { public ChatMember getChatMember(GetChatMember getChatMember) throws TelegramApiException {
return bot.getChatMember(getChatMember); return bot.execute(getChatMember);
} }
@Override @Override
public Integer getChatMemberCount(GetChatMemberCount getChatMemberCount) throws TelegramApiException { public Integer getChatMemberCount(GetChatMemberCount getChatMemberCount) throws TelegramApiException {
return bot.getChatMemberCount(getChatMemberCount); return bot.execute(getChatMemberCount);
} }
@Override @Override
@ -140,117 +140,117 @@ public class DefaultMessageSender implements MessageSender {
@Override @Override
public Boolean deleteChatPhoto(DeleteChatPhoto deleteChatPhoto) throws TelegramApiException { public Boolean deleteChatPhoto(DeleteChatPhoto deleteChatPhoto) throws TelegramApiException {
return bot.deleteChatPhoto(deleteChatPhoto); return bot.execute(deleteChatPhoto);
} }
@Override @Override
public void deleteChatPhoto(DeleteChatPhoto deleteChatPhoto, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void deleteChatPhoto(DeleteChatPhoto deleteChatPhoto, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.deleteChatPhoto(deleteChatPhoto, sentCallback); bot.executeAsync(deleteChatPhoto, sentCallback);
} }
@Override @Override
public Boolean pinChatMessage(PinChatMessage pinChatMessage) throws TelegramApiException { public Boolean pinChatMessage(PinChatMessage pinChatMessage) throws TelegramApiException {
return bot.pinChatMessage(pinChatMessage); return bot.execute(pinChatMessage);
} }
@Override @Override
public void pinChatMessage(PinChatMessage pinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void pinChatMessage(PinChatMessage pinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.pinChatMessage(pinChatMessage, sentCallback); bot.executeAsync(pinChatMessage, sentCallback);
} }
@Override @Override
public Boolean unpinChatMessage(UnpinChatMessage unpinChatMessage) throws TelegramApiException { public Boolean unpinChatMessage(UnpinChatMessage unpinChatMessage) throws TelegramApiException {
return bot.unpinChatMessage(unpinChatMessage); return bot.execute(unpinChatMessage);
} }
@Override @Override
public void unpinChatMessage(UnpinChatMessage unpinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void unpinChatMessage(UnpinChatMessage unpinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.unpinChatMessage(unpinChatMessage, sentCallback); bot.executeAsync(unpinChatMessage, sentCallback);
} }
@Override @Override
public Boolean promoteChatMember(PromoteChatMember promoteChatMember) throws TelegramApiException { public Boolean promoteChatMember(PromoteChatMember promoteChatMember) throws TelegramApiException {
return bot.promoteChatMember(promoteChatMember); return bot.execute(promoteChatMember);
} }
@Override @Override
public void promoteChatMember(PromoteChatMember promoteChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void promoteChatMember(PromoteChatMember promoteChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.promoteChatMember(promoteChatMember, sentCallback); bot.executeAsync(promoteChatMember, sentCallback);
} }
@Override @Override
public Boolean restrictChatMember(RestrictChatMember restrictChatMember) throws TelegramApiException { public Boolean restrictChatMember(RestrictChatMember restrictChatMember) throws TelegramApiException {
return bot.restrictChatMember(restrictChatMember); return bot.execute(restrictChatMember);
} }
@Override @Override
public void restrictChatMember(RestrictChatMember restrictChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void restrictChatMember(RestrictChatMember restrictChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.restrictChatMember(restrictChatMember, sentCallback); bot.executeAsync(restrictChatMember, sentCallback);
} }
@Override @Override
public Boolean setChatDescription(SetChatDescription setChatDescription) throws TelegramApiException { public Boolean setChatDescription(SetChatDescription setChatDescription) throws TelegramApiException {
return bot.setChatDescription(setChatDescription); return bot.execute(setChatDescription);
} }
@Override @Override
public void setChatDescription(SetChatDescription setChatDescription, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void setChatDescription(SetChatDescription setChatDescription, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.setChatDescription(setChatDescription, sentCallback); bot.executeAsync(setChatDescription, sentCallback);
} }
@Override @Override
public Boolean setChatTite(SetChatTitle setChatTitle) throws TelegramApiException { public Boolean setChatTite(SetChatTitle setChatTitle) throws TelegramApiException {
return bot.setChatTitle(setChatTitle); return bot.execute(setChatTitle);
} }
@Override @Override
public void setChatTite(SetChatTitle setChatTitle, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void setChatTite(SetChatTitle setChatTitle, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.setChatTitle(setChatTitle, sentCallback); bot.executeAsync(setChatTitle, sentCallback);
} }
@Override @Override
public String exportChatInviteLink(ExportChatInviteLink exportChatInviteLink) throws TelegramApiException { public String exportChatInviteLink(ExportChatInviteLink exportChatInviteLink) throws TelegramApiException {
return bot.exportChatInviteLink(exportChatInviteLink); return bot.execute(exportChatInviteLink);
} }
@Override @Override
public void exportChatInviteLinkAsync(ExportChatInviteLink exportChatInviteLink, SentCallback<String> sentCallback) throws TelegramApiException { public void exportChatInviteLinkAsync(ExportChatInviteLink exportChatInviteLink, SentCallback<String> sentCallback) throws TelegramApiException {
bot.exportChatInviteLinkAsync(exportChatInviteLink, sentCallback); bot.executeAsync(exportChatInviteLink, sentCallback);
} }
@Override @Override
public Boolean deleteMessage(DeleteMessage deleteMessage) throws TelegramApiException { public Boolean deleteMessage(DeleteMessage deleteMessage) throws TelegramApiException {
return bot.deleteMessage(deleteMessage); return bot.execute(deleteMessage);
} }
@Override @Override
public void deleteMessageAsync(DeleteMessage deleteMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void deleteMessageAsync(DeleteMessage deleteMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.deleteMessage(deleteMessage, sentCallback); bot.executeAsync(deleteMessage, sentCallback);
} }
@Override @Override
public Serializable editMessageText(EditMessageText editMessageText) throws TelegramApiException { public Serializable editMessageText(EditMessageText editMessageText) throws TelegramApiException {
return bot.editMessageText(editMessageText); return bot.execute(editMessageText);
} }
@Override @Override
public Serializable editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException { public Serializable editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException {
return bot.editMessageCaption(editMessageCaption); return bot.execute(editMessageCaption);
} }
@Override @Override
public Serializable editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException { public Serializable editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException {
return bot.editMessageReplyMarkup(editMessageReplyMarkup); return bot.execute(editMessageReplyMarkup);
} }
@Override @Override
public Boolean answerCallbackQuery(AnswerCallbackQuery answerCallbackQuery) throws TelegramApiException { public Boolean answerCallbackQuery(AnswerCallbackQuery answerCallbackQuery) throws TelegramApiException {
return bot.answerCallbackQuery(answerCallbackQuery); return bot.execute(answerCallbackQuery);
} }
@Override @Override
public UserProfilePhotos getUserProfilePhotos(GetUserProfilePhotos getUserProfilePhotos) throws TelegramApiException { public UserProfilePhotos getUserProfilePhotos(GetUserProfilePhotos getUserProfilePhotos) throws TelegramApiException {
return bot.getUserProfilePhotos(getUserProfilePhotos); return bot.execute(getUserProfilePhotos);
} }
@Override @Override
@ -275,7 +275,7 @@ public class DefaultMessageSender implements MessageSender {
@Override @Override
public File getFile(GetFile getFile) throws TelegramApiException { public File getFile(GetFile getFile) throws TelegramApiException {
return bot.getFile(getFile); return bot.execute(getFile);
} }
@Override @Override
@ -290,127 +290,127 @@ public class DefaultMessageSender implements MessageSender {
@Override @Override
public Serializable setGameScore(SetGameScore setGameScore) throws TelegramApiException { public Serializable setGameScore(SetGameScore setGameScore) throws TelegramApiException {
return bot.setGameScore(setGameScore); return bot.execute(setGameScore);
} }
@Override @Override
public Serializable getGameHighScores(GetGameHighScores getGameHighScores) throws TelegramApiException { public Serializable getGameHighScores(GetGameHighScores getGameHighScores) throws TelegramApiException {
return bot.getGameHighScores(getGameHighScores); return bot.execute(getGameHighScores);
} }
@Override @Override
public Message sendGame(SendGame sendGame) throws TelegramApiException { public Message sendGame(SendGame sendGame) throws TelegramApiException {
return bot.sendGame(sendGame); return bot.execute(sendGame);
} }
@Override @Override
public Boolean deleteWebhook(DeleteWebhook deleteWebhook) throws TelegramApiException { public Boolean deleteWebhook(DeleteWebhook deleteWebhook) throws TelegramApiException {
return bot.deleteWebhook(deleteWebhook); return bot.execute(deleteWebhook);
} }
@Override @Override
public Message sendMessage(SendMessage sendMessage) throws TelegramApiException { public Message sendMessage(SendMessage sendMessage) throws TelegramApiException {
return bot.sendMessage(sendMessage); return bot.execute(sendMessage);
} }
@Override @Override
public void sendMessageAsync(SendMessage sendMessage, SentCallback<Message> sentCallback) throws TelegramApiException { public void sendMessageAsync(SendMessage sendMessage, SentCallback<Message> sentCallback) throws TelegramApiException {
bot.sendMessageAsync(sendMessage, sentCallback); bot.executeAsync(sendMessage, sentCallback);
} }
@Override @Override
public void answerInlineQueryAsync(AnswerInlineQuery answerInlineQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void answerInlineQueryAsync(AnswerInlineQuery answerInlineQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.answerInlineQueryAsync(answerInlineQuery, sentCallback); bot.executeAsync(answerInlineQuery, sentCallback);
} }
@Override @Override
public void sendChatActionAsync(SendChatAction sendChatAction, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void sendChatActionAsync(SendChatAction sendChatAction, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.sendChatActionAsync(sendChatAction, sentCallback); bot.executeAsync(sendChatAction, sentCallback);
} }
@Override @Override
public void forwardMessageAsync(ForwardMessage forwardMessage, SentCallback<Message> sentCallback) throws TelegramApiException { public void forwardMessageAsync(ForwardMessage forwardMessage, SentCallback<Message> sentCallback) throws TelegramApiException {
bot.forwardMessageAsync(forwardMessage, sentCallback); bot.executeAsync(forwardMessage, sentCallback);
} }
@Override @Override
public void sendLocationAsync(SendLocation sendLocation, SentCallback<Message> sentCallback) throws TelegramApiException { public void sendLocationAsync(SendLocation sendLocation, SentCallback<Message> sentCallback) throws TelegramApiException {
bot.sendLocationAsync(sendLocation, sentCallback); bot.executeAsync(sendLocation, sentCallback);
} }
@Override @Override
public void sendVenueAsync(SendVenue sendVenue, SentCallback<Message> sentCallback) throws TelegramApiException { public void sendVenueAsync(SendVenue sendVenue, SentCallback<Message> sentCallback) throws TelegramApiException {
bot.sendVenueAsync(sendVenue, sentCallback); bot.executeAsync(sendVenue, sentCallback);
} }
@Override @Override
public void sendContactAsync(SendContact sendContact, SentCallback<Message> sentCallback) throws TelegramApiException { public void sendContactAsync(SendContact sendContact, SentCallback<Message> sentCallback) throws TelegramApiException {
bot.sendContactAsync(sendContact, sentCallback); bot.executeAsync(sendContact, sentCallback);
} }
@Override @Override
public void kickMemberAsync(KickChatMember kickChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void kickMemberAsync(KickChatMember kickChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.kickMemberAsync(kickChatMember, sentCallback); bot.executeAsync(kickChatMember, sentCallback);
} }
@Override @Override
public void unbanMemberAsync(UnbanChatMember unbanChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void unbanMemberAsync(UnbanChatMember unbanChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.unbanMemberAsync(unbanChatMember, sentCallback); bot.executeAsync(unbanChatMember, sentCallback);
} }
@Override @Override
public void leaveChatAsync(LeaveChat leaveChat, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void leaveChatAsync(LeaveChat leaveChat, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.leaveChatAsync(leaveChat, sentCallback); bot.executeAsync(leaveChat, sentCallback);
} }
@Override @Override
public void getChatAsync(GetChat getChat, SentCallback<Chat> sentCallback) throws TelegramApiException { public void getChatAsync(GetChat getChat, SentCallback<Chat> sentCallback) throws TelegramApiException {
bot.getChatAsync(getChat, sentCallback); bot.executeAsync(getChat, sentCallback);
} }
@Override @Override
public void getChatAdministratorsAsync(GetChatAdministrators getChatAdministrators, SentCallback<ArrayList<ChatMember>> sentCallback) throws TelegramApiException { public void getChatAdministratorsAsync(GetChatAdministrators getChatAdministrators, SentCallback<ArrayList<ChatMember>> sentCallback) throws TelegramApiException {
bot.getChatAdministratorsAsync(getChatAdministrators, sentCallback); bot.executeAsync(getChatAdministrators, sentCallback);
} }
@Override @Override
public void getChatMemberAsync(GetChatMember getChatMember, SentCallback<ChatMember> sentCallback) throws TelegramApiException { public void getChatMemberAsync(GetChatMember getChatMember, SentCallback<ChatMember> sentCallback) throws TelegramApiException {
bot.getChatMemberAsync(getChatMember, sentCallback); bot.executeAsync(getChatMember, sentCallback);
} }
@Override @Override
public void getChatMemberCountAsync(GetChatMemberCount getChatMemberCount, SentCallback<Integer> sentCallback) throws TelegramApiException { public void getChatMemberCountAsync(GetChatMemberCount getChatMemberCount, SentCallback<Integer> sentCallback) throws TelegramApiException {
bot.getChatMemberCountAsync(getChatMemberCount, sentCallback); bot.executeAsync(getChatMemberCount, sentCallback);
} }
@Override @Override
public void editMessageTextAsync(EditMessageText editMessageText, SentCallback<Serializable> sentCallback) throws TelegramApiException { public void editMessageTextAsync(EditMessageText editMessageText, SentCallback<Serializable> sentCallback) throws TelegramApiException {
bot.editMessageTextAsync(editMessageText, sentCallback); bot.executeAsync(editMessageText, sentCallback);
} }
@Override @Override
public void editMessageCaptionAsync(EditMessageCaption editMessageCaption, SentCallback<Serializable> sentCallback) throws TelegramApiException { public void editMessageCaptionAsync(EditMessageCaption editMessageCaption, SentCallback<Serializable> sentCallback) throws TelegramApiException {
bot.editMessageCaptionAsync(editMessageCaption, sentCallback); bot.executeAsync(editMessageCaption, sentCallback);
} }
@Override @Override
public void editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup, SentCallback<Serializable> sentCallback) throws TelegramApiException { public void editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup, SentCallback<Serializable> sentCallback) throws TelegramApiException {
bot.editMessageReplyMarkup(editMessageReplyMarkup, sentCallback); bot.executeAsync(editMessageReplyMarkup, sentCallback);
} }
@Override @Override
public void answerCallbackQueryAsync(AnswerCallbackQuery answerCallbackQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void answerCallbackQueryAsync(AnswerCallbackQuery answerCallbackQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.answerCallbackQueryAsync(answerCallbackQuery, sentCallback); bot.executeAsync(answerCallbackQuery, sentCallback);
} }
@Override @Override
public void getUserProfilePhotosAsync(GetUserProfilePhotos getUserProfilePhotos, SentCallback<UserProfilePhotos> sentCallback) throws TelegramApiException { public void getUserProfilePhotosAsync(GetUserProfilePhotos getUserProfilePhotos, SentCallback<UserProfilePhotos> sentCallback) throws TelegramApiException {
bot.getUserProfilePhotosAsync(getUserProfilePhotos, sentCallback); bot.executeAsync(getUserProfilePhotos, sentCallback);
} }
@Override @Override
public void getFileAsync(GetFile getFile, SentCallback<File> sentCallback) throws TelegramApiException { public void getFileAsync(GetFile getFile, SentCallback<File> sentCallback) throws TelegramApiException {
bot.getFileAsync(getFile, sentCallback); bot.executeAsync(getFile, sentCallback);
} }
@Override @Override
@ -425,22 +425,22 @@ public class DefaultMessageSender implements MessageSender {
@Override @Override
public void setGameScoreAsync(SetGameScore setGameScore, SentCallback<Serializable> sentCallback) throws TelegramApiException { public void setGameScoreAsync(SetGameScore setGameScore, SentCallback<Serializable> sentCallback) throws TelegramApiException {
bot.setGameScoreAsync(setGameScore, sentCallback); bot.executeAsync(setGameScore, sentCallback);
} }
@Override @Override
public void getGameHighScoresAsync(GetGameHighScores getGameHighScores, SentCallback<ArrayList<GameHighScore>> sentCallback) throws TelegramApiException { public void getGameHighScoresAsync(GetGameHighScores getGameHighScores, SentCallback<ArrayList<GameHighScore>> sentCallback) throws TelegramApiException {
bot.getGameHighScoresAsync(getGameHighScores, sentCallback); bot.executeAsync(getGameHighScores, sentCallback);
} }
@Override @Override
public void sendGameAsync(SendGame sendGame, SentCallback<Message> sentCallback) throws TelegramApiException { public void sendGameAsync(SendGame sendGame, SentCallback<Message> sentCallback) throws TelegramApiException {
bot.sendGameAsync(sendGame, sentCallback); bot.executeAsync(sendGame, sentCallback);
} }
@Override @Override
public void deleteWebhook(DeleteWebhook deleteWebhook, SentCallback<Boolean> sentCallback) throws TelegramApiException { public void deleteWebhook(DeleteWebhook deleteWebhook, SentCallback<Boolean> sentCallback) throws TelegramApiException {
bot.deleteWebhook(deleteWebhook, sentCallback); bot.executeAsync(deleteWebhook, sentCallback);
} }
@Override @Override

View File

@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency> <dependency>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId> <artifactId>telegrambotsextensions</artifactId>
<version>3.1.2</version> <version>3.2</version>
</dependency> </dependency>
``` ```
2. Using Gradle: 2. Using Gradle:
```gradle ```gradle
compile "org.telegram:telegrambotsextensions:3.1.2" compile "org.telegram:telegrambotsextensions:3.2"
``` ```

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId> <artifactId>telegrambotsextensions</artifactId>
<version>3.1.2</version> <version>3.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Telegram Bots Extensions</name> <name>Telegram Bots Extensions</name>
@ -59,7 +59,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>3.1.2</bots.version> <bots.version>3.2</bots.version>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -24,17 +24,6 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
private final CommandRegistry commandRegistry; private final CommandRegistry commandRegistry;
private String botUsername; private String botUsername;
/**
* Creates a TelegramLongPollingCommandBot using default options
* Use ICommandRegistry's methods on this bot to register commands
*
* @deprecated Uses {@link #TelegramLongPollingCommandBot(String)} instead
*/
@Deprecated
public TelegramLongPollingCommandBot() {
this(ApiContext.getInstance(DefaultBotOptions.class));
}
/** /**
* Creates a TelegramLongPollingCommandBot using default options * Creates a TelegramLongPollingCommandBot using default options
* Use ICommandRegistry's methods on this bot to register commands * Use ICommandRegistry's methods on this bot to register commands
@ -45,19 +34,6 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
this(ApiContext.getInstance(DefaultBotOptions.class), botUsername); this(ApiContext.getInstance(DefaultBotOptions.class), botUsername);
} }
/**
* Creates a TelegramLongPollingCommandBot with custom options and allowing commands with
* usernames
* Use ICommandRegistry's methods on this bot to register commands
* @param options Bot options
*
* @deprecated Use {@link #TelegramLongPollingCommandBot(DefaultBotOptions, String)} instead
*/
@Deprecated
public TelegramLongPollingCommandBot(DefaultBotOptions options) {
this(options, true);
}
/** /**
* Creates a TelegramLongPollingCommandBot with custom options and allowing commands with * Creates a TelegramLongPollingCommandBot with custom options and allowing commands with
* usernames * usernames
@ -69,21 +45,6 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
this(options, true, botUsername); this(options, true, botUsername);
} }
/**
* Creates a TelegramLongPollingCommandBot
* Use ICommandRegistry's methods on this bot to register commands
* @param options Bot options
* @param allowCommandsWithUsername true to allow commands with parameters (default),
* false otherwise
*
* @deprecated Use {@link #TelegramLongPollingCommandBot(DefaultBotOptions, boolean, String)} instead
*/
@Deprecated
public TelegramLongPollingCommandBot(DefaultBotOptions options, boolean allowCommandsWithUsername) {
super(options);
this.commandRegistry = new CommandRegistry(allowCommandsWithUsername, getBotUsername());
}
/** /**
* Creates a TelegramLongPollingCommandBot * Creates a TelegramLongPollingCommandBot
* Use ICommandRegistry's methods on this bot to register commands * Use ICommandRegistry's methods on this bot to register commands
@ -164,11 +125,10 @@ public abstract class TelegramLongPollingCommandBot extends TelegramLongPollingB
} }
/** /**
* TODO This method will become final in next mayor release, avoid overriding it
* @return Bot username * @return Bot username
*/ */
@Override @Override
public String getBotUsername() { public final String getBotUsername() {
return botUsername; return botUsername;
} }

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots-meta</artifactId> <artifactId>telegrambots-meta</artifactId>
<version>3.1.2</version> <version>3.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Telegram Bots Meta</name> <name>Telegram Bots Meta</name>

View File

@ -50,6 +50,7 @@ public class ApiContext {
return INJECTOR; return INJECTOR;
} }
@SuppressWarnings("unchecked")
private static class ApiModule extends AbstractModule { private static class ApiModule extends AbstractModule {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -0,0 +1,190 @@
package org.telegram.telegrambots.api.methods.stickers;
import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.api.objects.replykeyboard.ApiResponse;
import org.telegram.telegrambots.api.objects.stickers.MaskPosition;
import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 1.0
* Use this method to add a new sticker to a set created by the bot. Returns True on success.
*/
public class AddStickerToSet extends PartialBotApiMethod<Boolean> {
public static final String PATH = "addStickerToSet";
public static final String USERID_FIELD = "user_id";
public static final String NAME_FIELD = "name";
public static final String PNGSTICKER_FIELD = "png_sticker";
public static final String EMOJIS_FIELD = "emojis";
public static final String MASKPOSITION_FIELD = "mask_position";
private Integer userId; ///< User identifier of sticker set owner
private String name; ///< Sticker set name
private String emojis; ///< One or more emoji corresponding to the sticker
private MaskPosition maskPosition; ///< Position where the mask should be placed on faces
/**
* Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
* and either width or height must be exactly 512px. Pass a file_id as a String to send a file
* that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram
* to get a file from the Internet, or upload a new one using multipart/form-data.
*/
private Boolean isNewPngSticker;
private String pngSticker;
private File pngStickerFile; ///< New sticker file
private InputStream pngStickerStream; ///< New sticker stream
private String pngStickerName; ///< New sticker stream name
public AddStickerToSet() {
super();
}
public AddStickerToSet(Integer userId, String name, String emojis) {
this.userId = checkNotNull(userId);
this.name = checkNotNull(name);
this.emojis = checkNotNull(emojis);
}
public Integer getUserId() {
return userId;
}
public AddStickerToSet setUserId(Integer userId) {
this.userId = userId;
return this;
}
public String getPngSticker() {
return pngSticker;
}
public AddStickerToSet setPngSticker(String pngSticker) {
this.pngSticker = pngSticker;
this.isNewPngSticker = false;
return this;
}
public File getPngStickerFile() {
return pngStickerFile;
}
public AddStickerToSet setPngStickerFile(File pngStickerFile) {
Objects.requireNonNull(pngStickerFile, "pngStickerFile cannot be null!");
this.pngStickerFile = pngStickerFile;
this.isNewPngSticker = true;
return this;
}
public InputStream getPngStickerStream() {
return pngStickerStream;
}
public AddStickerToSet setPngStickerStream(String pngStickerName, InputStream pngStickerStream) {
Objects.requireNonNull(pngStickerName, "pngStickerName cannot be null!");
Objects.requireNonNull(pngStickerStream, "pngStickerStream cannot be null!");
this.pngStickerStream = pngStickerStream;
this.pngStickerName = pngStickerName;
this.isNewPngSticker = true;
return this;
}
public String getPngStickerName() {
return pngStickerName;
}
public Boolean isNewPngSticker() {
return isNewPngSticker;
}
public String getName() {
return name;
}
public AddStickerToSet setName(String name) {
this.name = name;
return this;
}
public String getEmojis() {
return emojis;
}
public AddStickerToSet setEmojis(String emojis) {
this.emojis = emojis;
return this;
}
public MaskPosition getMaskPosition() {
return maskPosition;
}
public AddStickerToSet setMaskPosition(MaskPosition maskPosition) {
this.maskPosition = maskPosition;
return this;
}
@Override
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
new TypeReference<ApiResponse<Boolean>>(){});
if (result.getOk()) {
return result.getResult();
} else {
throw new TelegramApiRequestException("Error creating new sticker set", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
@Override
public void validate() throws TelegramApiValidationException {
if (userId == null || userId <= 0) {
throw new TelegramApiValidationException("userId can't be empty", this);
}
if (name == null || name.isEmpty()) {
throw new TelegramApiValidationException("name can't be empty", this);
}
if (emojis == null || emojis.isEmpty()) {
throw new TelegramApiValidationException("emojis can't be empty", this);
}
if (isNewPngSticker) {
if (pngStickerFile == null && pngStickerStream == null) {
throw new TelegramApiValidationException("PngSticker can't be empty", this);
}
if (pngStickerStream != null && (pngStickerName == null || pngStickerName.isEmpty())) {
throw new TelegramApiValidationException("PngSticker name can't be empty", this);
}
} else if (pngSticker == null) {
throw new TelegramApiValidationException("PngSticker can't be empty", this);
}
if (maskPosition != null) {
maskPosition.validate();
}
}
@Override
public String toString() {
return "AddStickerToSet{" +
"userId=" + userId +
", name='" + name + '\'' +
", emojis='" + emojis + '\'' +
", maskPosition=" + maskPosition +
", isNewPngSticker=" + isNewPngSticker +
", pngSticker='" + pngSticker + '\'' +
", pngStickerFile=" + pngStickerFile +
", pngStickerStream=" + pngStickerStream +
", pngStickerName='" + pngStickerName + '\'' +
'}';
}
}

View File

@ -0,0 +1,220 @@
package org.telegram.telegrambots.api.methods.stickers;
import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.api.objects.replykeyboard.ApiResponse;
import org.telegram.telegrambots.api.objects.stickers.MaskPosition;
import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 1.0
* Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set.
* Returns True on success.
*/
public class CreateNewStickerSet extends PartialBotApiMethod<Boolean> {
public static final String PATH = "createNewStickerSet";
public static final String USERID_FIELD = "user_id";
public static final String NAME_FIELD = "name";
public static final String TITLE_FIELD = "title";
public static final String PNGSTICKER_FIELD = "png_sticker";
public static final String EMOJIS_FIELD = "emojis";
public static final String CONTAINSMASKS_FIELD = "contains_masks";
public static final String MASKPOSITION_FIELD = "mask_position";
private Integer userId; ///< User identifier of created sticker set owner
/**
* Name of sticker set, to be used in t.me/addstickers/<name> URLs.
* Can contain only english letters, digits and underscores.
* Must begin with a letter, can't contain consecutive underscores and must end in _by_<bot username>.
* <bot_username> is case insensitive. 7-64 characters.
*/
private String name; ///< Sticker set title, 1-64 characters
private String title; ///< User identifier of created sticker set owner
private String emojis; ///< One or more emoji corresponding to the sticker
private Boolean containsMasks; ///< Pass True, if a set of mask stickers should be created
private MaskPosition maskPosition; ///< Position where the mask should be placed on faces
/**
* Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
* and either width or height must be exactly 512px.
* Pass a file_id as a String to send a file that already exists on the Telegram servers,
* pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one
* using multipart/form-data. More info on Sending Files »
*/
private Boolean isNewPngSticker;
private String pngSticker;
private java.io.File pngStickerFile; ///< New sticker file
private InputStream pngStickerStream; ///< New sticker stream
private String pngStickerName; ///< New sticker stream name
public CreateNewStickerSet() {
super();
}
public CreateNewStickerSet(Integer userId, String name, String title, String emojis) {
this.userId = checkNotNull(userId);
this.name = checkNotNull(name);
this.title = checkNotNull(title);
this.emojis = checkNotNull(emojis);
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getPngSticker() {
return pngSticker;
}
public CreateNewStickerSet setPngSticker(String pngSticker) {
this.pngSticker = pngSticker;
this.isNewPngSticker = false;
return this;
}
public File getPngStickerFile() {
return pngStickerFile;
}
public CreateNewStickerSet setPngStickerFile(File pngStickerFile) {
Objects.requireNonNull(pngStickerFile, "pngStickerFile cannot be null!");
this.pngStickerFile = pngStickerFile;
this.isNewPngSticker = true;
return this;
}
public InputStream getPngStickerStream() {
return pngStickerStream;
}
public CreateNewStickerSet setPngStickerStream(String pngStickerName, InputStream pngStickerStream) {
Objects.requireNonNull(pngStickerName, "pngStickerName cannot be null!");
Objects.requireNonNull(pngStickerStream, "pngStickerStream cannot be null!");
this.pngStickerStream = pngStickerStream;
this.pngStickerName = pngStickerName;
this.isNewPngSticker = true;
return this;
}
public String getPngStickerName() {
return pngStickerName;
}
public Boolean isNewPngSticker() {
return isNewPngSticker;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getEmojis() {
return emojis;
}
public void setEmojis(String emojis) {
this.emojis = emojis;
}
public Boolean getContainsMasks() {
return containsMasks;
}
public void setContainsMasks(Boolean containsMasks) {
this.containsMasks = containsMasks;
}
public MaskPosition getMaskPosition() {
return maskPosition;
}
public void setMaskPosition(MaskPosition maskPosition) {
this.maskPosition = maskPosition;
}
@Override
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
new TypeReference<ApiResponse<Boolean>>(){});
if (result.getOk()) {
return result.getResult();
} else {
throw new TelegramApiRequestException("Error creating new sticker set", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
@Override
public void validate() throws TelegramApiValidationException {
if (userId == null || userId <= 0) {
throw new TelegramApiValidationException("userId can't be empty", this);
}
if (name == null || name.isEmpty()) {
throw new TelegramApiValidationException("name can't be empty", this);
}
if (title == null || title.isEmpty()) {
throw new TelegramApiValidationException("userId can't be empty", this);
}
if (emojis == null || emojis.isEmpty()) {
throw new TelegramApiValidationException("emojis can't be empty", this);
}
if (isNewPngSticker) {
if (pngStickerFile == null && pngStickerStream == null) {
throw new TelegramApiValidationException("PngSticker can't be empty", this);
}
if (pngStickerStream != null && (pngStickerName == null || pngStickerName.isEmpty())) {
throw new TelegramApiValidationException("PngSticker name can't be empty", this);
}
} else if (pngSticker == null) {
throw new TelegramApiValidationException("PngSticker can't be empty", this);
}
if (maskPosition != null) {
maskPosition.validate();
}
}
@Override
public String toString() {
return "CreateNewStickerSet{" +
"userId=" + userId +
", name='" + name + '\'' +
", title='" + title + '\'' +
", emojis='" + emojis + '\'' +
", containsMasks=" + containsMasks +
", maskPosition=" + maskPosition +
", isNewPngSticker=" + isNewPngSticker +
", pngSticker='" + pngSticker + '\'' +
", pngStickerFile=" + pngStickerFile +
", pngStickerStream=" + pngStickerStream +
", pngStickerName='" + pngStickerName + '\'' +
'}';
}
}

View File

@ -0,0 +1,78 @@
package org.telegram.telegrambots.api.methods.stickers;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.api.methods.BotApiMethod;
import org.telegram.telegrambots.api.objects.replykeyboard.ApiResponse;
import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
import java.io.IOException;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 1.0
* Use this method to delete a sticker from a set created by the bot. Returns True on success.
*/
public class DeleteStickerFromSet extends BotApiMethod<Boolean> {
private static final String PATH = "deleteStickerFromSet";
private static final String STICKER_FIELD = "sticker";
@JsonProperty(STICKER_FIELD)
private String sticker; ///< File identifier of the sticker
public DeleteStickerFromSet() {
super();
}
public DeleteStickerFromSet(String sticker) {
super();
this.sticker = checkNotNull(sticker);
}
@Override
public String getMethod() {
return PATH;
}
@Override
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
new TypeReference<ApiResponse<Boolean>>(){});
if (result.getOk()) {
return result.getResult();
} else {
throw new TelegramApiRequestException("Error deleting sticker from set", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
@Override
public void validate() throws TelegramApiValidationException {
if (sticker == null || sticker.isEmpty()) {
throw new TelegramApiValidationException("sticker can't be null", this);
}
}
public String getSticker() {
return sticker;
}
public DeleteStickerFromSet setSticker(String sticker) {
this.sticker = sticker;
return this;
}
@Override
public String toString() {
return "DeleteStickerFromSet{" +
"sticker='" + sticker + '\'' +
'}';
}
}

View File

@ -0,0 +1,79 @@
package org.telegram.telegrambots.api.methods.stickers;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.api.methods.BotApiMethod;
import org.telegram.telegrambots.api.objects.replykeyboard.ApiResponse;
import org.telegram.telegrambots.api.objects.stickers.StickerSet;
import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
import java.io.IOException;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 1.0
* Use this method to get a sticker set. On success, a StickerSet object is returned.
*/
public class GetStickerSet extends BotApiMethod<StickerSet> {
private static final String PATH = "getStickerSet";
private static final String NAME_FIELD = "name";
@JsonProperty(NAME_FIELD)
private String name; ///< Name of the sticker set
public GetStickerSet(String name) {
super();
this.name = checkNotNull(name);
}
public GetStickerSet() {
super();
}
@Override
public String getMethod() {
return PATH;
}
@Override
public StickerSet deserializeResponse(String answer) throws TelegramApiRequestException {
try {
ApiResponse<StickerSet> result = OBJECT_MAPPER.readValue(answer,
new TypeReference<ApiResponse<StickerSet>>(){});
if (result.getOk()) {
return result.getResult();
} else {
throw new TelegramApiRequestException("Error getting sticker set", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
@Override
public void validate() throws TelegramApiValidationException {
if (name == null || name.isEmpty()) {
throw new TelegramApiValidationException("Name can't be null", this);
}
}
public String getName() {
return name;
}
public GetStickerSet setName(String name) {
this.name = name;
return this;
}
@Override
public String toString() {
return "GetStickerSet{" +
"name='" + name + '\'' +
'}';
}
}

View File

@ -0,0 +1,94 @@
package org.telegram.telegrambots.api.methods.stickers;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.api.methods.BotApiMethod;
import org.telegram.telegrambots.api.objects.replykeyboard.ApiResponse;
import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
import java.io.IOException;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 1.0
* Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
*/
public class SetStickerPositionInSet extends BotApiMethod<Boolean> {
private static final String PATH = "getStickerSet";
private static final String STICKER_FIELD = "sticker";
private static final String POSITION_FIELD = "position";
@JsonProperty(STICKER_FIELD)
private String sticker; ///< File identifier of the sticker
@JsonProperty(STICKER_FIELD)
private Integer position; ///< New sticker position in the set, zero-based
public SetStickerPositionInSet(String sticker, Integer position) {
this.sticker = checkNotNull(sticker);
this.position = checkNotNull(position);
}
public SetStickerPositionInSet() {
super();
}
@Override
public String getMethod() {
return PATH;
}
@Override
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
new TypeReference<ApiResponse<Boolean>>(){});
if (result.getOk()) {
return result.getResult();
} else {
throw new TelegramApiRequestException("Error setting sticker position in set", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
@Override
public void validate() throws TelegramApiValidationException {
if (sticker == null || sticker.isEmpty()) {
throw new TelegramApiValidationException("sticker can't be null", this);
}
if (position == null || position > 0) {
throw new TelegramApiValidationException("position can't be null", this);
}
}
public String getSticker() {
return sticker;
}
public SetStickerPositionInSet setSticker(String sticker) {
this.sticker = sticker;
return this;
}
public Integer getPosition() {
return position;
}
public SetStickerPositionInSet setPosition(Integer position) {
this.position = position;
return this;
}
@Override
public String toString() {
return "SetStickerPositionInSet{" +
"sticker='" + sticker + '\'' +
", position=" + position +
'}';
}
}

View File

@ -0,0 +1,114 @@
package org.telegram.telegrambots.api.methods.stickers;
import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.api.objects.File;
import org.telegram.telegrambots.api.objects.replykeyboard.ApiResponse;
import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
import java.io.IOException;
import java.io.InputStream;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 1.0
* Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet
* methods (can be used multiple times). Returns the uploaded File on success.
*/
public class UploadStickerFile extends PartialBotApiMethod<File> {
public static final String PATH = "uploadStickerFile";
public static final String USERID_FIELD = "name";
public static final String PNGSTICKER_FIELD = "png_sticker";
private Integer userId; ///< User identifier of sticker file owner
/**
* Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
* and either width or height must be exactly 512px. More info on Sending Files »
*/
private java.io.File newPngStickerFile; ///< New sticker file
private InputStream newPngStickerStream; ///< New sticker stream
private String newPngStickerName; ///< New sticker stream name
public UploadStickerFile() {
super();
}
public UploadStickerFile(Integer userId) {
super();
this.userId = checkNotNull(userId);
}
@Override
public File deserializeResponse(String answer) throws TelegramApiRequestException {
try {
ApiResponse<File> result = OBJECT_MAPPER.readValue(answer,
new TypeReference<ApiResponse<File>>(){});
if (result.getOk()) {
return result.getResult();
} else {
throw new TelegramApiRequestException("Error uploading sticker set", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", e);
}
}
@Override
public void validate() throws TelegramApiValidationException {
if (userId == null || userId <= 0) {
throw new TelegramApiValidationException("userId can't be empty", this);
}
if (newPngStickerFile == null && newPngStickerStream == null) {
throw new TelegramApiValidationException("file or stream must be present", this);
}
if (newPngStickerStream != null && (newPngStickerName == null || newPngStickerName.isEmpty())) {
throw new TelegramApiValidationException("Stream name must be present", this);
}
}
public Integer getUserId() {
return userId;
}
public UploadStickerFile setUserId(Integer userId) {
this.userId = userId;
return this;
}
public java.io.File getNewPngStickerFile() {
return newPngStickerFile;
}
public UploadStickerFile setNewPngSticker(java.io.File newPngStickerFile) {
this.newPngStickerFile = newPngStickerFile;
return this;
}
public InputStream getNewPngStickerStream() {
return newPngStickerStream;
}
public UploadStickerFile setNewPngSticker(String newPngStickerName, InputStream newPngStickerStream) {
this.newPngStickerName = newPngStickerName;
this.newPngStickerStream = newPngStickerStream;
return this;
}
public String getNewPngStickerName() {
return newPngStickerName;
}
@Override
public String toString() {
return "UploadStickerFile{" +
"userId=" + userId +
", newPngStickerFile=" + newPngStickerFile +
", newPngStickerStream=" + newPngStickerStream +
", newPngStickerName='" + newPngStickerName + '\'' +
'}';
}
}

View File

@ -5,6 +5,7 @@ import org.telegram.telegrambots.api.interfaces.BotApiObject;
import org.telegram.telegrambots.api.objects.games.Game; import org.telegram.telegrambots.api.objects.games.Game;
import org.telegram.telegrambots.api.objects.payments.Invoice; import org.telegram.telegrambots.api.objects.payments.Invoice;
import org.telegram.telegrambots.api.objects.payments.SuccessfulPayment; import org.telegram.telegrambots.api.objects.payments.SuccessfulPayment;
import org.telegram.telegrambots.api.objects.stickers.Sticker;
import java.util.List; import java.util.List;

View File

@ -0,0 +1,89 @@
package org.telegram.telegrambots.api.objects.stickers;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.api.interfaces.InputBotApiObject;
import org.telegram.telegrambots.api.interfaces.Validable;
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 3.2
* This object describes the position on faces where a mask should be placed by default.
*/
public class MaskPosition implements InputBotApiObject, Validable {
private static final String POINT_FIELD = "point";
private static final String XSHIFT_FIELD = "x_shift";
private static final String YSHIFT_FIELD = "y_shift";
private static final String SCALE_FIELD = "scale";
@JsonProperty(POINT_FIELD)
private String point; ///< The part of the face relative to which the mask should be placed. One of forehead, eyes, mouth, or chin.
@JsonProperty(XSHIFT_FIELD)
private Float xShift; ///< Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
@JsonProperty(YSHIFT_FIELD)
private Float yShift; ///< Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
@JsonProperty(SCALE_FIELD)
private Float scale; ///< Mask scaling coefficient. For example, 2.0 means double size.
public MaskPosition() {
super();
}
public String getPoint() {
return point;
}
public Float getxShift() {
return xShift;
}
public Float getyShift() {
return yShift;
}
public Float getScale() {
return scale;
}
public void setPoint(String point) {
this.point = point;
}
public void setxShift(Float xShift) {
this.xShift = xShift;
}
public void setyShift(Float yShift) {
this.yShift = yShift;
}
public void setScale(Float scale) {
this.scale = scale;
}
@Override
public String toString() {
return "MaskPosition{" +
"point='" + point + '\'' +
", xShift=" + xShift +
", yShift=" + yShift +
", scale=" + scale +
'}';
}
@Override
public void validate() throws TelegramApiValidationException {
if (point == null || point.isEmpty()) {
throw new TelegramApiValidationException("point can't be empty", this);
}
if (xShift == null) {
throw new TelegramApiValidationException("xShift can't be empty", this);
}
if (yShift == null) {
throw new TelegramApiValidationException("yShift can't be empty", this);
}
if (scale == null) {
throw new TelegramApiValidationException("scale can't be empty", this);
}
}
}

View File

@ -1,14 +1,14 @@
package org.telegram.telegrambots.api.objects; package org.telegram.telegrambots.api.objects.stickers;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.api.interfaces.BotApiObject; import org.telegram.telegrambots.api.interfaces.BotApiObject;
import org.telegram.telegrambots.api.objects.PhotoSize;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief This object represents a sticker. * @brief This object represents a sticker.
* @date 20 of June of 2015
*/ */
public class Sticker implements BotApiObject { public class Sticker implements BotApiObject {
@ -18,6 +18,8 @@ public class Sticker implements BotApiObject {
private static final String THUMB_FIELD = "thumb"; private static final String THUMB_FIELD = "thumb";
private static final String FILESIZE_FIELD = "file_size"; private static final String FILESIZE_FIELD = "file_size";
private static final String EMOJI_FIELD = "emoji"; private static final String EMOJI_FIELD = "emoji";
private static final String SETNAME_FIELD = "set_name";
private static final String MASKPOSITON_FIELD = "mask_position";
@JsonProperty(FILEID_FIELD) @JsonProperty(FILEID_FIELD)
private String fileId; ///< Unique identifier for this file private String fileId; ///< Unique identifier for this file
@ -31,6 +33,10 @@ public class Sticker implements BotApiObject {
private Integer fileSize; ///< Optional. File size private Integer fileSize; ///< Optional. File size
@JsonProperty(EMOJI_FIELD) @JsonProperty(EMOJI_FIELD)
private String emoji; ///< Optional. Emoji associated with the sticker private String emoji; ///< Optional. Emoji associated with the sticker
@JsonProperty(SETNAME_FIELD)
private String setName; ///< Optional. Name of the sticker set to which the sticker belongs
@JsonProperty(MASKPOSITON_FIELD)
private String maskPosition; ///< Optional. For mask stickers, the position where the mask should be placed
public Sticker() { public Sticker() {
super(); super();
@ -60,6 +66,14 @@ public class Sticker implements BotApiObject {
return emoji; return emoji;
} }
public String getSetName() {
return setName;
}
public String getMaskPosition() {
return maskPosition;
}
@Override @Override
public String toString() { public String toString() {
return "Sticker{" + return "Sticker{" +
@ -68,7 +82,9 @@ public class Sticker implements BotApiObject {
", height=" + height + ", height=" + height +
", thumb=" + thumb + ", thumb=" + thumb +
", fileSize=" + fileSize + ", fileSize=" + fileSize +
", emoji=" + emoji + ", emoji='" + emoji + '\'' +
", setName='" + setName + '\'' +
", maskPosition='" + maskPosition + '\'' +
'}'; '}';
} }
} }

View File

@ -0,0 +1,57 @@
package org.telegram.telegrambots.api.objects.stickers;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.api.interfaces.BotApiObject;
import java.util.List;
/**
* @author Ruben Bermudez
* @version 1.0
* This object represents a sticker set.
*/
public class StickerSet implements BotApiObject {
private static final String NAME_FIELD = "name";
private static final String TITLE_FIELD = "title";
private static final String CONTAINSMASKS_FIELD = "contains_masks";
private static final String STICKERS_FIELD = "stickers";
@JsonProperty(NAME_FIELD)
private String name;
@JsonProperty(TITLE_FIELD)
private String title;
@JsonProperty(CONTAINSMASKS_FIELD)
private Boolean containsMasks;
@JsonProperty(STICKERS_FIELD)
private List<Sticker> stickers;
public StickerSet() {
super();
}
public String getName() {
return name;
}
public String getTitle() {
return title;
}
public Boolean getContainsMasks() {
return containsMasks;
}
public List<Sticker> getStickers() {
return stickers;
}
@Override
public String toString() {
return "StickerSet{" +
"name='" + name + '\'' +
", title='" + title + '\'' +
", containsMasks=" + containsMasks +
", stickers=" + stickers +
'}';
}
}

View File

@ -7,6 +7,9 @@ import org.telegram.telegrambots.api.methods.groupadministration.*;
import org.telegram.telegrambots.api.methods.pinnedmessages.PinChatMessage; import org.telegram.telegrambots.api.methods.pinnedmessages.PinChatMessage;
import org.telegram.telegrambots.api.methods.pinnedmessages.UnpinChatMessage; import org.telegram.telegrambots.api.methods.pinnedmessages.UnpinChatMessage;
import org.telegram.telegrambots.api.methods.send.*; import org.telegram.telegrambots.api.methods.send.*;
import org.telegram.telegrambots.api.methods.stickers.AddStickerToSet;
import org.telegram.telegrambots.api.methods.stickers.CreateNewStickerSet;
import org.telegram.telegrambots.api.methods.stickers.UploadStickerFile;
import org.telegram.telegrambots.api.methods.updates.DeleteWebhook; import org.telegram.telegrambots.api.methods.updates.DeleteWebhook;
import org.telegram.telegrambots.api.methods.updates.GetWebhookInfo; import org.telegram.telegrambots.api.methods.updates.GetWebhookInfo;
import org.telegram.telegrambots.api.methods.updatingmessages.DeleteMessage; import org.telegram.telegrambots.api.methods.updatingmessages.DeleteMessage;
@ -52,6 +55,7 @@ public abstract class AbsSender {
// Send Requests // Send Requests
@Deprecated
public final Message sendMessage(SendMessage sendMessage) throws TelegramApiException { public final Message sendMessage(SendMessage sendMessage) throws TelegramApiException {
if (sendMessage == null) { if (sendMessage == null) {
throw new TelegramApiException("Parameter sendMessage can not be null"); throw new TelegramApiException("Parameter sendMessage can not be null");
@ -60,6 +64,7 @@ public abstract class AbsSender {
return sendApiMethod(sendMessage); return sendApiMethod(sendMessage);
} }
@Deprecated
public final Boolean answerInlineQuery(AnswerInlineQuery answerInlineQuery) throws TelegramApiException { public final Boolean answerInlineQuery(AnswerInlineQuery answerInlineQuery) throws TelegramApiException {
if (answerInlineQuery == null) { if (answerInlineQuery == null) {
throw new TelegramApiException("Parameter answerInlineQuery can not be null"); throw new TelegramApiException("Parameter answerInlineQuery can not be null");
@ -68,6 +73,7 @@ public abstract class AbsSender {
return sendApiMethod(answerInlineQuery); return sendApiMethod(answerInlineQuery);
} }
@Deprecated
public final Boolean sendChatAction(SendChatAction sendChatAction) throws TelegramApiException { public final Boolean sendChatAction(SendChatAction sendChatAction) throws TelegramApiException {
if (sendChatAction == null) { if (sendChatAction == null) {
throw new TelegramApiException("Parameter sendChatAction can not be null"); throw new TelegramApiException("Parameter sendChatAction can not be null");
@ -76,6 +82,7 @@ public abstract class AbsSender {
return sendApiMethod(sendChatAction); return sendApiMethod(sendChatAction);
} }
@Deprecated
public final Message forwardMessage(ForwardMessage forwardMessage) throws TelegramApiException { public final Message forwardMessage(ForwardMessage forwardMessage) throws TelegramApiException {
if (forwardMessage == null) { if (forwardMessage == null) {
throw new TelegramApiException("Parameter forwardMessage can not be null"); throw new TelegramApiException("Parameter forwardMessage can not be null");
@ -84,6 +91,7 @@ public abstract class AbsSender {
return sendApiMethod(forwardMessage); return sendApiMethod(forwardMessage);
} }
@Deprecated
public final Message sendLocation(SendLocation sendLocation) throws TelegramApiException { public final Message sendLocation(SendLocation sendLocation) throws TelegramApiException {
if (sendLocation == null) { if (sendLocation == null) {
throw new TelegramApiException("Parameter sendLocation can not be null"); throw new TelegramApiException("Parameter sendLocation can not be null");
@ -92,6 +100,7 @@ public abstract class AbsSender {
return sendApiMethod(sendLocation); return sendApiMethod(sendLocation);
} }
@Deprecated
public final Message sendVenue(SendVenue sendVenue) throws TelegramApiException { public final Message sendVenue(SendVenue sendVenue) throws TelegramApiException {
if (sendVenue == null) { if (sendVenue == null) {
throw new TelegramApiException("Parameter sendVenue can not be null"); throw new TelegramApiException("Parameter sendVenue can not be null");
@ -100,6 +109,7 @@ public abstract class AbsSender {
return sendApiMethod(sendVenue); return sendApiMethod(sendVenue);
} }
@Deprecated
public final Message sendContact(SendContact sendContact) throws TelegramApiException { public final Message sendContact(SendContact sendContact) throws TelegramApiException {
if (sendContact == null) { if (sendContact == null) {
throw new TelegramApiException("Parameter sendContact can not be null"); throw new TelegramApiException("Parameter sendContact can not be null");
@ -108,6 +118,7 @@ public abstract class AbsSender {
return sendApiMethod(sendContact); return sendApiMethod(sendContact);
} }
@Deprecated
public final Boolean kickMember(KickChatMember kickChatMember) throws TelegramApiException { public final Boolean kickMember(KickChatMember kickChatMember) throws TelegramApiException {
if (kickChatMember == null) { if (kickChatMember == null) {
throw new TelegramApiException("Parameter kickChatMember can not be null"); throw new TelegramApiException("Parameter kickChatMember can not be null");
@ -115,6 +126,7 @@ public abstract class AbsSender {
return sendApiMethod(kickChatMember); return sendApiMethod(kickChatMember);
} }
@Deprecated
public final Boolean unbanMember(UnbanChatMember unbanChatMember) throws TelegramApiException { public final Boolean unbanMember(UnbanChatMember unbanChatMember) throws TelegramApiException {
if (unbanChatMember == null) { if (unbanChatMember == null) {
throw new TelegramApiException("Parameter unbanChatMember can not be null"); throw new TelegramApiException("Parameter unbanChatMember can not be null");
@ -122,6 +134,7 @@ public abstract class AbsSender {
return sendApiMethod(unbanChatMember); return sendApiMethod(unbanChatMember);
} }
@Deprecated
public final Boolean leaveChat(LeaveChat leaveChat) throws TelegramApiException { public final Boolean leaveChat(LeaveChat leaveChat) throws TelegramApiException {
if (leaveChat == null) { if (leaveChat == null) {
throw new TelegramApiException("Parameter leaveChat can not be null"); throw new TelegramApiException("Parameter leaveChat can not be null");
@ -129,6 +142,7 @@ public abstract class AbsSender {
return sendApiMethod(leaveChat); return sendApiMethod(leaveChat);
} }
@Deprecated
public final Chat getChat(GetChat getChat) throws TelegramApiException { public final Chat getChat(GetChat getChat) throws TelegramApiException {
if (getChat == null) { if (getChat == null) {
throw new TelegramApiException("Parameter getChat can not be null"); throw new TelegramApiException("Parameter getChat can not be null");
@ -136,6 +150,7 @@ public abstract class AbsSender {
return sendApiMethod(getChat); return sendApiMethod(getChat);
} }
@Deprecated
public final String exportChatInviteLink(ExportChatInviteLink exportChatInviteLink) throws TelegramApiException { public final String exportChatInviteLink(ExportChatInviteLink exportChatInviteLink) throws TelegramApiException {
if (exportChatInviteLink == null) { if (exportChatInviteLink == null) {
throw new TelegramApiException("Parameter exportChatInviteLink can not be null"); throw new TelegramApiException("Parameter exportChatInviteLink can not be null");
@ -143,6 +158,7 @@ public abstract class AbsSender {
return sendApiMethod(exportChatInviteLink); return sendApiMethod(exportChatInviteLink);
} }
@Deprecated
public final List<ChatMember> getChatAdministrators(GetChatAdministrators getChatAdministrators) throws TelegramApiException { public final List<ChatMember> getChatAdministrators(GetChatAdministrators getChatAdministrators) throws TelegramApiException {
if (getChatAdministrators == null) { if (getChatAdministrators == null) {
throw new TelegramApiException("Parameter getChatAdministrators can not be null"); throw new TelegramApiException("Parameter getChatAdministrators can not be null");
@ -150,6 +166,7 @@ public abstract class AbsSender {
return sendApiMethod(getChatAdministrators); return sendApiMethod(getChatAdministrators);
} }
@Deprecated
public final ChatMember getChatMember(GetChatMember getChatMember) throws TelegramApiException { public final ChatMember getChatMember(GetChatMember getChatMember) throws TelegramApiException {
if (getChatMember == null) { if (getChatMember == null) {
throw new TelegramApiException("Parameter getChatMember can not be null"); throw new TelegramApiException("Parameter getChatMember can not be null");
@ -157,6 +174,7 @@ public abstract class AbsSender {
return sendApiMethod(getChatMember); return sendApiMethod(getChatMember);
} }
@Deprecated
public final Integer getChatMemberCount(GetChatMemberCount getChatMemberCount) throws TelegramApiException { public final Integer getChatMemberCount(GetChatMemberCount getChatMemberCount) throws TelegramApiException {
if (getChatMemberCount == null) { if (getChatMemberCount == null) {
throw new TelegramApiException("Parameter getChatMemberCount can not be null"); throw new TelegramApiException("Parameter getChatMemberCount can not be null");
@ -164,6 +182,7 @@ public abstract class AbsSender {
return sendApiMethod(getChatMemberCount); return sendApiMethod(getChatMemberCount);
} }
@Deprecated
public final Serializable editMessageText(EditMessageText editMessageText) throws TelegramApiException { public final Serializable editMessageText(EditMessageText editMessageText) throws TelegramApiException {
if (editMessageText == null) { if (editMessageText == null) {
throw new TelegramApiException("Parameter editMessageText can not be null"); throw new TelegramApiException("Parameter editMessageText can not be null");
@ -171,6 +190,7 @@ public abstract class AbsSender {
return sendApiMethod(editMessageText); return sendApiMethod(editMessageText);
} }
@Deprecated
public final Serializable editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException { public final Serializable editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException {
if (editMessageCaption == null) { if (editMessageCaption == null) {
throw new TelegramApiException("Parameter editMessageCaption can not be null"); throw new TelegramApiException("Parameter editMessageCaption can not be null");
@ -178,6 +198,7 @@ public abstract class AbsSender {
return sendApiMethod(editMessageCaption); return sendApiMethod(editMessageCaption);
} }
@Deprecated
public final Serializable editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException { public final Serializable editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException {
if (editMessageReplyMarkup == null) { if (editMessageReplyMarkup == null) {
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null"); throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
@ -185,6 +206,7 @@ public abstract class AbsSender {
return sendApiMethod(editMessageReplyMarkup); return sendApiMethod(editMessageReplyMarkup);
} }
@Deprecated
public final Boolean answerCallbackQuery(AnswerCallbackQuery answerCallbackQuery) throws TelegramApiException { public final Boolean answerCallbackQuery(AnswerCallbackQuery answerCallbackQuery) throws TelegramApiException {
if (answerCallbackQuery == null) { if (answerCallbackQuery == null) {
throw new TelegramApiException("Parameter answerCallbackQuery can not be null"); throw new TelegramApiException("Parameter answerCallbackQuery can not be null");
@ -192,6 +214,7 @@ public abstract class AbsSender {
return sendApiMethod(answerCallbackQuery); return sendApiMethod(answerCallbackQuery);
} }
@Deprecated
public final UserProfilePhotos getUserProfilePhotos(GetUserProfilePhotos getUserProfilePhotos) throws TelegramApiException { public final UserProfilePhotos getUserProfilePhotos(GetUserProfilePhotos getUserProfilePhotos) throws TelegramApiException {
if (getUserProfilePhotos == null) { if (getUserProfilePhotos == null) {
throw new TelegramApiException("Parameter getUserProfilePhotos can not be null"); throw new TelegramApiException("Parameter getUserProfilePhotos can not be null");
@ -200,6 +223,7 @@ public abstract class AbsSender {
return sendApiMethod(getUserProfilePhotos); return sendApiMethod(getUserProfilePhotos);
} }
@Deprecated
public final File getFile(GetFile getFile) throws TelegramApiException { public final File getFile(GetFile getFile) throws TelegramApiException {
if(getFile == null){ if(getFile == null){
throw new TelegramApiException("Parameter getFile can not be null"); throw new TelegramApiException("Parameter getFile can not be null");
@ -211,9 +235,7 @@ public abstract class AbsSender {
} }
public final User getMe() throws TelegramApiException { public final User getMe() throws TelegramApiException {
GetMe getMe = new GetMe(); return sendApiMethod(new GetMe());
return sendApiMethod(getMe);
} }
public final WebhookInfo getWebhookInfo() throws TelegramApiException { public final WebhookInfo getWebhookInfo() throws TelegramApiException {
@ -221,6 +243,7 @@ public abstract class AbsSender {
return sendApiMethod(getWebhookInfo); return sendApiMethod(getWebhookInfo);
} }
@Deprecated
public final Serializable setGameScore(SetGameScore setGameScore) throws TelegramApiException { public final Serializable setGameScore(SetGameScore setGameScore) throws TelegramApiException {
if(setGameScore == null){ if(setGameScore == null){
throw new TelegramApiException("Parameter setGameScore can not be null"); throw new TelegramApiException("Parameter setGameScore can not be null");
@ -228,6 +251,7 @@ public abstract class AbsSender {
return sendApiMethod(setGameScore); return sendApiMethod(setGameScore);
} }
@Deprecated
public final Serializable getGameHighScores(GetGameHighScores getGameHighScores) throws TelegramApiException { public final Serializable getGameHighScores(GetGameHighScores getGameHighScores) throws TelegramApiException {
if(getGameHighScores == null){ if(getGameHighScores == null){
throw new TelegramApiException("Parameter getGameHighScores can not be null"); throw new TelegramApiException("Parameter getGameHighScores can not be null");
@ -235,6 +259,7 @@ public abstract class AbsSender {
return sendApiMethod(getGameHighScores); return sendApiMethod(getGameHighScores);
} }
@Deprecated
public final Message sendGame(SendGame sendGame) throws TelegramApiException { public final Message sendGame(SendGame sendGame) throws TelegramApiException {
if(sendGame == null){ if(sendGame == null){
throw new TelegramApiException("Parameter sendGame can not be null"); throw new TelegramApiException("Parameter sendGame can not be null");
@ -242,6 +267,7 @@ public abstract class AbsSender {
return sendApiMethod(sendGame); return sendApiMethod(sendGame);
} }
@Deprecated
public final Boolean deleteWebhook(DeleteWebhook deleteWebhook) throws TelegramApiException { public final Boolean deleteWebhook(DeleteWebhook deleteWebhook) throws TelegramApiException {
if(deleteWebhook == null){ if(deleteWebhook == null){
throw new TelegramApiException("Parameter deleteWebhook can not be null"); throw new TelegramApiException("Parameter deleteWebhook can not be null");
@ -249,6 +275,7 @@ public abstract class AbsSender {
return sendApiMethod(deleteWebhook); return sendApiMethod(deleteWebhook);
} }
@Deprecated
public final Message sendInvoice(SendInvoice sendInvoice) throws TelegramApiException { public final Message sendInvoice(SendInvoice sendInvoice) throws TelegramApiException {
if(sendInvoice == null){ if(sendInvoice == null){
throw new TelegramApiException("Parameter sendInvoice can not be null"); throw new TelegramApiException("Parameter sendInvoice can not be null");
@ -256,6 +283,7 @@ public abstract class AbsSender {
return sendApiMethod(sendInvoice); return sendApiMethod(sendInvoice);
} }
@Deprecated
public final Boolean answerShippingQuery(AnswerShippingQuery answerShippingQuery) throws TelegramApiException { public final Boolean answerShippingQuery(AnswerShippingQuery answerShippingQuery) throws TelegramApiException {
if(answerShippingQuery == null){ if(answerShippingQuery == null){
throw new TelegramApiException("Parameter answerShippingQuery can not be null"); throw new TelegramApiException("Parameter answerShippingQuery can not be null");
@ -263,6 +291,7 @@ public abstract class AbsSender {
return sendApiMethod(answerShippingQuery); return sendApiMethod(answerShippingQuery);
} }
@Deprecated
public final Boolean answerPreCheckoutQuery(AnswerPreCheckoutQuery answerPreCheckoutQuery) throws TelegramApiException { public final Boolean answerPreCheckoutQuery(AnswerPreCheckoutQuery answerPreCheckoutQuery) throws TelegramApiException {
if(answerPreCheckoutQuery == null){ if(answerPreCheckoutQuery == null){
throw new TelegramApiException("Parameter answerPreCheckoutQuery can not be null"); throw new TelegramApiException("Parameter answerPreCheckoutQuery can not be null");
@ -270,6 +299,7 @@ public abstract class AbsSender {
return sendApiMethod(answerPreCheckoutQuery); return sendApiMethod(answerPreCheckoutQuery);
} }
@Deprecated
public final Boolean deleteMessage(DeleteMessage deleteMessage) throws TelegramApiException { public final Boolean deleteMessage(DeleteMessage deleteMessage) throws TelegramApiException {
if(deleteMessage == null){ if(deleteMessage == null){
throw new TelegramApiException("Parameter deleteMessage can not be null"); throw new TelegramApiException("Parameter deleteMessage can not be null");
@ -277,6 +307,7 @@ public abstract class AbsSender {
return sendApiMethod(deleteMessage); return sendApiMethod(deleteMessage);
} }
@Deprecated
public final Boolean deleteChatPhoto(DeleteChatPhoto deleteChatPhoto) throws TelegramApiException { public final Boolean deleteChatPhoto(DeleteChatPhoto deleteChatPhoto) throws TelegramApiException {
if(deleteChatPhoto == null){ if(deleteChatPhoto == null){
throw new TelegramApiException("Parameter deleteChatPhoto can not be null"); throw new TelegramApiException("Parameter deleteChatPhoto can not be null");
@ -284,6 +315,7 @@ public abstract class AbsSender {
return sendApiMethod(deleteChatPhoto); return sendApiMethod(deleteChatPhoto);
} }
@Deprecated
public final Boolean pinChatMessage(PinChatMessage pinChatMessage) throws TelegramApiException { public final Boolean pinChatMessage(PinChatMessage pinChatMessage) throws TelegramApiException {
if(pinChatMessage == null){ if(pinChatMessage == null){
throw new TelegramApiException("Parameter pinChatMessage can not be null"); throw new TelegramApiException("Parameter pinChatMessage can not be null");
@ -291,6 +323,7 @@ public abstract class AbsSender {
return sendApiMethod(pinChatMessage); return sendApiMethod(pinChatMessage);
} }
@Deprecated
public final Boolean unpinChatMessage(UnpinChatMessage unpinChatMessage) throws TelegramApiException { public final Boolean unpinChatMessage(UnpinChatMessage unpinChatMessage) throws TelegramApiException {
if(unpinChatMessage == null){ if(unpinChatMessage == null){
throw new TelegramApiException("Parameter unpinChatMessage can not be null"); throw new TelegramApiException("Parameter unpinChatMessage can not be null");
@ -298,6 +331,7 @@ public abstract class AbsSender {
return sendApiMethod(unpinChatMessage); return sendApiMethod(unpinChatMessage);
} }
@Deprecated
public final Boolean promoteChatMember(PromoteChatMember promoteChatMember) throws TelegramApiException { public final Boolean promoteChatMember(PromoteChatMember promoteChatMember) throws TelegramApiException {
if(promoteChatMember == null){ if(promoteChatMember == null){
throw new TelegramApiException("Parameter promoteChatMember can not be null"); throw new TelegramApiException("Parameter promoteChatMember can not be null");
@ -305,6 +339,7 @@ public abstract class AbsSender {
return sendApiMethod(promoteChatMember); return sendApiMethod(promoteChatMember);
} }
@Deprecated
public final Boolean restrictChatMember(RestrictChatMember restrictChatMember) throws TelegramApiException { public final Boolean restrictChatMember(RestrictChatMember restrictChatMember) throws TelegramApiException {
if(restrictChatMember == null){ if(restrictChatMember == null){
throw new TelegramApiException("Parameter restrictChatMember can not be null"); throw new TelegramApiException("Parameter restrictChatMember can not be null");
@ -312,6 +347,7 @@ public abstract class AbsSender {
return sendApiMethod(restrictChatMember); return sendApiMethod(restrictChatMember);
} }
@Deprecated
public final Boolean setChatDescription(SetChatDescription setChatDescription) throws TelegramApiException { public final Boolean setChatDescription(SetChatDescription setChatDescription) throws TelegramApiException {
if(setChatDescription == null){ if(setChatDescription == null){
throw new TelegramApiException("Parameter setChatDescription can not be null"); throw new TelegramApiException("Parameter setChatDescription can not be null");
@ -319,6 +355,7 @@ public abstract class AbsSender {
return sendApiMethod(setChatDescription); return sendApiMethod(setChatDescription);
} }
@Deprecated
public final Boolean setChatTitle(SetChatTitle setChatTitle) throws TelegramApiException { public final Boolean setChatTitle(SetChatTitle setChatTitle) throws TelegramApiException {
if(setChatTitle == null){ if(setChatTitle == null){
throw new TelegramApiException("Parameter setChatTitle can not be null"); throw new TelegramApiException("Parameter setChatTitle can not be null");
@ -328,6 +365,7 @@ public abstract class AbsSender {
// Send Requests Async // Send Requests Async
@Deprecated
public final void sendMessageAsync(SendMessage sendMessage, SentCallback<Message> sentCallback) throws TelegramApiException { public final void sendMessageAsync(SendMessage sendMessage, SentCallback<Message> sentCallback) throws TelegramApiException {
if (sendMessage == null) { if (sendMessage == null) {
throw new TelegramApiException("Parameter sendMessage can not be null"); throw new TelegramApiException("Parameter sendMessage can not be null");
@ -340,6 +378,7 @@ public abstract class AbsSender {
sendApiMethodAsync(sendMessage, sentCallback); sendApiMethodAsync(sendMessage, sentCallback);
} }
@Deprecated
public final void answerInlineQueryAsync(AnswerInlineQuery answerInlineQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void answerInlineQueryAsync(AnswerInlineQuery answerInlineQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (answerInlineQuery == null) { if (answerInlineQuery == null) {
throw new TelegramApiException("Parameter answerInlineQuery can not be null"); throw new TelegramApiException("Parameter answerInlineQuery can not be null");
@ -352,6 +391,7 @@ public abstract class AbsSender {
sendApiMethodAsync(answerInlineQuery, sentCallback); sendApiMethodAsync(answerInlineQuery, sentCallback);
} }
@Deprecated
public final void sendChatActionAsync(SendChatAction sendChatAction, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void sendChatActionAsync(SendChatAction sendChatAction, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (sendChatAction == null) { if (sendChatAction == null) {
throw new TelegramApiException("Parameter sendChatAction can not be null"); throw new TelegramApiException("Parameter sendChatAction can not be null");
@ -364,6 +404,7 @@ public abstract class AbsSender {
sendApiMethodAsync(sendChatAction, sentCallback); sendApiMethodAsync(sendChatAction, sentCallback);
} }
@Deprecated
public final void forwardMessageAsync(ForwardMessage forwardMessage, SentCallback<Message> sentCallback) throws TelegramApiException { public final void forwardMessageAsync(ForwardMessage forwardMessage, SentCallback<Message> sentCallback) throws TelegramApiException {
if (forwardMessage == null) { if (forwardMessage == null) {
throw new TelegramApiException("Parameter forwardMessage can not be null"); throw new TelegramApiException("Parameter forwardMessage can not be null");
@ -376,6 +417,7 @@ public abstract class AbsSender {
sendApiMethodAsync(forwardMessage, sentCallback); sendApiMethodAsync(forwardMessage, sentCallback);
} }
@Deprecated
public final void sendLocationAsync(SendLocation sendLocation, SentCallback<Message> sentCallback) throws TelegramApiException { public final void sendLocationAsync(SendLocation sendLocation, SentCallback<Message> sentCallback) throws TelegramApiException {
if (sendLocation == null) { if (sendLocation == null) {
throw new TelegramApiException("Parameter sendLocation can not be null"); throw new TelegramApiException("Parameter sendLocation can not be null");
@ -388,6 +430,7 @@ public abstract class AbsSender {
sendApiMethodAsync(sendLocation, sentCallback); sendApiMethodAsync(sendLocation, sentCallback);
} }
@Deprecated
public final void sendVenueAsync(SendVenue sendVenue, SentCallback<Message> sentCallback) throws TelegramApiException { public final void sendVenueAsync(SendVenue sendVenue, SentCallback<Message> sentCallback) throws TelegramApiException {
if (sendVenue == null) { if (sendVenue == null) {
throw new TelegramApiException("Parameter sendVenue can not be null"); throw new TelegramApiException("Parameter sendVenue can not be null");
@ -400,6 +443,7 @@ public abstract class AbsSender {
sendApiMethodAsync(sendVenue, sentCallback); sendApiMethodAsync(sendVenue, sentCallback);
} }
@Deprecated
public final void sendContactAsync(SendContact sendContact, SentCallback<Message> sentCallback) throws TelegramApiException { public final void sendContactAsync(SendContact sendContact, SentCallback<Message> sentCallback) throws TelegramApiException {
if (sendContact == null) { if (sendContact == null) {
throw new TelegramApiException("Parameter sendContact can not be null"); throw new TelegramApiException("Parameter sendContact can not be null");
@ -411,6 +455,7 @@ public abstract class AbsSender {
sendApiMethodAsync(sendContact, sentCallback); sendApiMethodAsync(sendContact, sentCallback);
} }
@Deprecated
public final void kickMemberAsync(KickChatMember kickChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void kickMemberAsync(KickChatMember kickChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (kickChatMember == null) { if (kickChatMember == null) {
throw new TelegramApiException("Parameter kickChatMember can not be null"); throw new TelegramApiException("Parameter kickChatMember can not be null");
@ -422,6 +467,7 @@ public abstract class AbsSender {
sendApiMethodAsync(kickChatMember, sentCallback); sendApiMethodAsync(kickChatMember, sentCallback);
} }
@Deprecated
public final void unbanMemberAsync(UnbanChatMember unbanChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void unbanMemberAsync(UnbanChatMember unbanChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (unbanChatMember == null) { if (unbanChatMember == null) {
throw new TelegramApiException("Parameter unbanChatMember can not be null"); throw new TelegramApiException("Parameter unbanChatMember can not be null");
@ -433,6 +479,7 @@ public abstract class AbsSender {
sendApiMethodAsync(unbanChatMember, sentCallback); sendApiMethodAsync(unbanChatMember, sentCallback);
} }
@Deprecated
public final void leaveChatAsync(LeaveChat leaveChat, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void leaveChatAsync(LeaveChat leaveChat, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (leaveChat == null) { if (leaveChat == null) {
throw new TelegramApiException("Parameter leaveChat can not be null"); throw new TelegramApiException("Parameter leaveChat can not be null");
@ -443,6 +490,7 @@ public abstract class AbsSender {
sendApiMethodAsync(leaveChat, sentCallback); sendApiMethodAsync(leaveChat, sentCallback);
} }
@Deprecated
public final void getChatAsync(GetChat getChat, SentCallback<Chat> sentCallback) throws TelegramApiException { public final void getChatAsync(GetChat getChat, SentCallback<Chat> sentCallback) throws TelegramApiException {
if (getChat == null) { if (getChat == null) {
throw new TelegramApiException("Parameter getChat can not be null"); throw new TelegramApiException("Parameter getChat can not be null");
@ -453,6 +501,7 @@ public abstract class AbsSender {
sendApiMethodAsync(getChat, sentCallback); sendApiMethodAsync(getChat, sentCallback);
} }
@Deprecated
public final void exportChatInviteLinkAsync(ExportChatInviteLink exportChatInviteLink, SentCallback<String> sentCallback) throws TelegramApiException { public final void exportChatInviteLinkAsync(ExportChatInviteLink exportChatInviteLink, SentCallback<String> sentCallback) throws TelegramApiException {
if (exportChatInviteLink == null) { if (exportChatInviteLink == null) {
throw new TelegramApiException("Parameter exportChatInviteLink can not be null"); throw new TelegramApiException("Parameter exportChatInviteLink can not be null");
@ -463,6 +512,7 @@ public abstract class AbsSender {
sendApiMethodAsync(exportChatInviteLink, sentCallback); sendApiMethodAsync(exportChatInviteLink, sentCallback);
} }
@Deprecated
public final void getChatAdministratorsAsync(GetChatAdministrators getChatAdministrators, SentCallback<ArrayList<ChatMember>> sentCallback) throws TelegramApiException { public final void getChatAdministratorsAsync(GetChatAdministrators getChatAdministrators, SentCallback<ArrayList<ChatMember>> sentCallback) throws TelegramApiException {
if (getChatAdministrators == null) { if (getChatAdministrators == null) {
throw new TelegramApiException("Parameter getChatAdministrators can not be null"); throw new TelegramApiException("Parameter getChatAdministrators can not be null");
@ -473,6 +523,7 @@ public abstract class AbsSender {
sendApiMethodAsync(getChatAdministrators, sentCallback); sendApiMethodAsync(getChatAdministrators, sentCallback);
} }
@Deprecated
public final void getChatMemberAsync(GetChatMember getChatMember, SentCallback<ChatMember> sentCallback) throws TelegramApiException { public final void getChatMemberAsync(GetChatMember getChatMember, SentCallback<ChatMember> sentCallback) throws TelegramApiException {
if (getChatMember == null) { if (getChatMember == null) {
throw new TelegramApiException("Parameter getChatMember can not be null"); throw new TelegramApiException("Parameter getChatMember can not be null");
@ -483,6 +534,7 @@ public abstract class AbsSender {
sendApiMethodAsync(getChatMember, sentCallback); sendApiMethodAsync(getChatMember, sentCallback);
} }
@Deprecated
public final void getChatMemberCountAsync(GetChatMemberCount getChatMemberCount, SentCallback<Integer> sentCallback) throws TelegramApiException { public final void getChatMemberCountAsync(GetChatMemberCount getChatMemberCount, SentCallback<Integer> sentCallback) throws TelegramApiException {
if (getChatMemberCount == null) { if (getChatMemberCount == null) {
throw new TelegramApiException("Parameter getChatMemberCount can not be null"); throw new TelegramApiException("Parameter getChatMemberCount can not be null");
@ -494,6 +546,7 @@ public abstract class AbsSender {
sendApiMethodAsync(getChatMemberCount, sentCallback); sendApiMethodAsync(getChatMemberCount, sentCallback);
} }
@Deprecated
public final void editMessageTextAsync(EditMessageText editMessageText, SentCallback<Serializable> sentCallback) throws TelegramApiException { public final void editMessageTextAsync(EditMessageText editMessageText, SentCallback<Serializable> sentCallback) throws TelegramApiException {
if (editMessageText == null) { if (editMessageText == null) {
throw new TelegramApiException("Parameter editMessageText can not be null"); throw new TelegramApiException("Parameter editMessageText can not be null");
@ -505,6 +558,7 @@ public abstract class AbsSender {
sendApiMethodAsync(editMessageText, sentCallback); sendApiMethodAsync(editMessageText, sentCallback);
} }
@Deprecated
public final void editMessageCaptionAsync(EditMessageCaption editMessageCaption, SentCallback<Serializable> sentCallback) throws TelegramApiException { public final void editMessageCaptionAsync(EditMessageCaption editMessageCaption, SentCallback<Serializable> sentCallback) throws TelegramApiException {
if (editMessageCaption == null) { if (editMessageCaption == null) {
throw new TelegramApiException("Parameter editMessageCaption can not be null"); throw new TelegramApiException("Parameter editMessageCaption can not be null");
@ -516,6 +570,7 @@ public abstract class AbsSender {
sendApiMethodAsync(editMessageCaption, sentCallback); sendApiMethodAsync(editMessageCaption, sentCallback);
} }
@Deprecated
public final void editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup, SentCallback<Serializable> sentCallback) throws TelegramApiException { public final void editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup, SentCallback<Serializable> sentCallback) throws TelegramApiException {
if (editMessageReplyMarkup == null) { if (editMessageReplyMarkup == null) {
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null"); throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
@ -527,6 +582,7 @@ public abstract class AbsSender {
sendApiMethodAsync(editMessageReplyMarkup, sentCallback); sendApiMethodAsync(editMessageReplyMarkup, sentCallback);
} }
@Deprecated
public final void answerCallbackQueryAsync(AnswerCallbackQuery answerCallbackQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void answerCallbackQueryAsync(AnswerCallbackQuery answerCallbackQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (answerCallbackQuery == null) { if (answerCallbackQuery == null) {
throw new TelegramApiException("Parameter answerCallbackQuery can not be null"); throw new TelegramApiException("Parameter answerCallbackQuery can not be null");
@ -538,6 +594,7 @@ public abstract class AbsSender {
sendApiMethodAsync(answerCallbackQuery, sentCallback); sendApiMethodAsync(answerCallbackQuery, sentCallback);
} }
@Deprecated
public final void getUserProfilePhotosAsync(GetUserProfilePhotos getUserProfilePhotos, SentCallback<UserProfilePhotos> sentCallback) throws TelegramApiException { public final void getUserProfilePhotosAsync(GetUserProfilePhotos getUserProfilePhotos, SentCallback<UserProfilePhotos> sentCallback) throws TelegramApiException {
if (getUserProfilePhotos == null) { if (getUserProfilePhotos == null) {
throw new TelegramApiException("Parameter getUserProfilePhotos can not be null"); throw new TelegramApiException("Parameter getUserProfilePhotos can not be null");
@ -549,6 +606,7 @@ public abstract class AbsSender {
sendApiMethodAsync(getUserProfilePhotos, sentCallback); sendApiMethodAsync(getUserProfilePhotos, sentCallback);
} }
@Deprecated
public final void getFileAsync(GetFile getFile, SentCallback<File> sentCallback) throws TelegramApiException { public final void getFileAsync(GetFile getFile, SentCallback<File> sentCallback) throws TelegramApiException {
if (getFile == null) { if (getFile == null) {
throw new TelegramApiException("Parameter getFile can not be null"); throw new TelegramApiException("Parameter getFile can not be null");
@ -564,19 +622,17 @@ public abstract class AbsSender {
if (sentCallback == null) { if (sentCallback == null) {
throw new TelegramApiException("Parameter sentCallback can not be null"); throw new TelegramApiException("Parameter sentCallback can not be null");
} }
GetMe getMe = new GetMe(); sendApiMethodAsync(new GetMe(), sentCallback);
sendApiMethodAsync(getMe, sentCallback);
} }
public final void getWebhookInfoAsync(SentCallback<WebhookInfo> sentCallback) throws TelegramApiException { public final void getWebhookInfoAsync(SentCallback<WebhookInfo> sentCallback) throws TelegramApiException {
if (sentCallback == null) { if (sentCallback == null) {
throw new TelegramApiException("Parameter sentCallback can not be null"); throw new TelegramApiException("Parameter sentCallback can not be null");
} }
sendApiMethodAsync(new GetWebhookInfo(), sentCallback);
GetWebhookInfo getWebhookInfo = new GetWebhookInfo();
sendApiMethodAsync(getWebhookInfo, sentCallback);
} }
@Deprecated
public final void setGameScoreAsync(SetGameScore setGameScore, SentCallback<Serializable> sentCallback) throws TelegramApiException { public final void setGameScoreAsync(SetGameScore setGameScore, SentCallback<Serializable> sentCallback) throws TelegramApiException {
if (setGameScore == null) { if (setGameScore == null) {
throw new TelegramApiException("Parameter setGameScore can not be null"); throw new TelegramApiException("Parameter setGameScore can not be null");
@ -587,6 +643,7 @@ public abstract class AbsSender {
sendApiMethodAsync(setGameScore, sentCallback); sendApiMethodAsync(setGameScore, sentCallback);
} }
@Deprecated
public final void getGameHighScoresAsync(GetGameHighScores getGameHighScores, SentCallback<ArrayList<GameHighScore>> sentCallback) throws TelegramApiException { public final void getGameHighScoresAsync(GetGameHighScores getGameHighScores, SentCallback<ArrayList<GameHighScore>> sentCallback) throws TelegramApiException {
if (getGameHighScores == null) { if (getGameHighScores == null) {
throw new TelegramApiException("Parameter getGameHighScores can not be null"); throw new TelegramApiException("Parameter getGameHighScores can not be null");
@ -597,6 +654,7 @@ public abstract class AbsSender {
sendApiMethodAsync(getGameHighScores, sentCallback); sendApiMethodAsync(getGameHighScores, sentCallback);
} }
@Deprecated
public final void sendGameAsync(SendGame sendGame, SentCallback<Message> sentCallback) throws TelegramApiException { public final void sendGameAsync(SendGame sendGame, SentCallback<Message> sentCallback) throws TelegramApiException {
if (sendGame == null) { if (sendGame == null) {
throw new TelegramApiException("Parameter sendGame can not be null"); throw new TelegramApiException("Parameter sendGame can not be null");
@ -607,6 +665,7 @@ public abstract class AbsSender {
sendApiMethodAsync(sendGame, sentCallback); sendApiMethodAsync(sendGame, sentCallback);
} }
@Deprecated
public final void deleteWebhook(DeleteWebhook deleteWebhook, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void deleteWebhook(DeleteWebhook deleteWebhook, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (deleteWebhook == null) { if (deleteWebhook == null) {
throw new TelegramApiException("Parameter deleteWebhook can not be null"); throw new TelegramApiException("Parameter deleteWebhook can not be null");
@ -617,6 +676,7 @@ public abstract class AbsSender {
sendApiMethodAsync(deleteWebhook, sentCallback); sendApiMethodAsync(deleteWebhook, sentCallback);
} }
@Deprecated
public final void sendInvoice(SendInvoice sendInvoice, SentCallback<Message> sentCallback) throws TelegramApiException { public final void sendInvoice(SendInvoice sendInvoice, SentCallback<Message> sentCallback) throws TelegramApiException {
if (sendInvoice == null) { if (sendInvoice == null) {
throw new TelegramApiException("Parameter sendInvoice can not be null"); throw new TelegramApiException("Parameter sendInvoice can not be null");
@ -627,6 +687,7 @@ public abstract class AbsSender {
sendApiMethodAsync(sendInvoice, sentCallback); sendApiMethodAsync(sendInvoice, sentCallback);
} }
@Deprecated
public final void answerShippingQuery(AnswerShippingQuery answerShippingQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void answerShippingQuery(AnswerShippingQuery answerShippingQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (answerShippingQuery == null) { if (answerShippingQuery == null) {
throw new TelegramApiException("Parameter answerShippingQuery can not be null"); throw new TelegramApiException("Parameter answerShippingQuery can not be null");
@ -637,6 +698,7 @@ public abstract class AbsSender {
sendApiMethodAsync(answerShippingQuery, sentCallback); sendApiMethodAsync(answerShippingQuery, sentCallback);
} }
@Deprecated
public final void answerPreCheckoutQuery(AnswerPreCheckoutQuery answerPreCheckoutQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void answerPreCheckoutQuery(AnswerPreCheckoutQuery answerPreCheckoutQuery, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (answerPreCheckoutQuery == null) { if (answerPreCheckoutQuery == null) {
throw new TelegramApiException("Parameter answerPreCheckoutQuery can not be null"); throw new TelegramApiException("Parameter answerPreCheckoutQuery can not be null");
@ -647,6 +709,7 @@ public abstract class AbsSender {
sendApiMethodAsync(answerPreCheckoutQuery, sentCallback); sendApiMethodAsync(answerPreCheckoutQuery, sentCallback);
} }
@Deprecated
public final void deleteMessage(DeleteMessage deleteMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void deleteMessage(DeleteMessage deleteMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (deleteMessage == null) { if (deleteMessage == null) {
throw new TelegramApiException("Parameter deleteMessage can not be null"); throw new TelegramApiException("Parameter deleteMessage can not be null");
@ -657,6 +720,7 @@ public abstract class AbsSender {
sendApiMethodAsync(deleteMessage, sentCallback); sendApiMethodAsync(deleteMessage, sentCallback);
} }
@Deprecated
public final void deleteChatPhoto(DeleteChatPhoto deleteChatPhoto, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void deleteChatPhoto(DeleteChatPhoto deleteChatPhoto, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (deleteChatPhoto == null) { if (deleteChatPhoto == null) {
throw new TelegramApiException("Parameter deleteChatPhoto can not be null"); throw new TelegramApiException("Parameter deleteChatPhoto can not be null");
@ -667,6 +731,7 @@ public abstract class AbsSender {
sendApiMethodAsync(deleteChatPhoto, sentCallback); sendApiMethodAsync(deleteChatPhoto, sentCallback);
} }
@Deprecated
public final void pinChatMessage(PinChatMessage pinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void pinChatMessage(PinChatMessage pinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (pinChatMessage == null) { if (pinChatMessage == null) {
throw new TelegramApiException("Parameter pinChatMessage can not be null"); throw new TelegramApiException("Parameter pinChatMessage can not be null");
@ -677,6 +742,7 @@ public abstract class AbsSender {
sendApiMethodAsync(pinChatMessage, sentCallback); sendApiMethodAsync(pinChatMessage, sentCallback);
} }
@Deprecated
public final void unpinChatMessage(UnpinChatMessage unpinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void unpinChatMessage(UnpinChatMessage unpinChatMessage, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (unpinChatMessage == null) { if (unpinChatMessage == null) {
throw new TelegramApiException("Parameter unpinChatMessage can not be null"); throw new TelegramApiException("Parameter unpinChatMessage can not be null");
@ -687,6 +753,7 @@ public abstract class AbsSender {
sendApiMethodAsync(unpinChatMessage, sentCallback); sendApiMethodAsync(unpinChatMessage, sentCallback);
} }
@Deprecated
public final void promoteChatMember(PromoteChatMember promoteChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void promoteChatMember(PromoteChatMember promoteChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (promoteChatMember == null) { if (promoteChatMember == null) {
throw new TelegramApiException("Parameter promoteChatMember can not be null"); throw new TelegramApiException("Parameter promoteChatMember can not be null");
@ -697,6 +764,7 @@ public abstract class AbsSender {
sendApiMethodAsync(promoteChatMember, sentCallback); sendApiMethodAsync(promoteChatMember, sentCallback);
} }
@Deprecated
public final void restrictChatMember(RestrictChatMember restrictChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void restrictChatMember(RestrictChatMember restrictChatMember, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (restrictChatMember == null) { if (restrictChatMember == null) {
throw new TelegramApiException("Parameter restrictChatMember can not be null"); throw new TelegramApiException("Parameter restrictChatMember can not be null");
@ -707,6 +775,7 @@ public abstract class AbsSender {
sendApiMethodAsync(restrictChatMember, sentCallback); sendApiMethodAsync(restrictChatMember, sentCallback);
} }
@Deprecated
public final void setChatDescription(SetChatDescription setChatDescription, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void setChatDescription(SetChatDescription setChatDescription, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (setChatDescription == null) { if (setChatDescription == null) {
throw new TelegramApiException("Parameter setChatDescription can not be null"); throw new TelegramApiException("Parameter setChatDescription can not be null");
@ -717,6 +786,7 @@ public abstract class AbsSender {
sendApiMethodAsync(setChatDescription, sentCallback); sendApiMethodAsync(setChatDescription, sentCallback);
} }
@Deprecated
public final void setChatTitle(SetChatTitle setChatTitle, SentCallback<Boolean> sentCallback) throws TelegramApiException { public final void setChatTitle(SetChatTitle setChatTitle, SentCallback<Boolean> sentCallback) throws TelegramApiException {
if (setChatTitle == null) { if (setChatTitle == null) {
throw new TelegramApiException("Parameter setChatTitle can not be null"); throw new TelegramApiException("Parameter setChatTitle can not be null");
@ -763,6 +833,30 @@ public abstract class AbsSender {
*/ */
public abstract Boolean setChatPhoto(SetChatPhoto setChatPhoto) throws TelegramApiException; public abstract Boolean setChatPhoto(SetChatPhoto setChatPhoto) throws TelegramApiException;
/**
* Adds a new sticker to a set (https://core.telegram.org/bots/api#addStickerToSet)
* @param addStickerToSet Information of the sticker to set
* @return If success, true is returned
* @throws TelegramApiException If there is any error adding the sticker to the set
*/
public abstract Boolean addStickerToSet(AddStickerToSet addStickerToSet) throws TelegramApiException;
/**
* Creates a new sticker set (https://core.telegram.org/bots/api#createNewStickerSet)
* @param createNewStickerSet Information of the sticker set to create
* @return If success, true is returned
* @throws TelegramApiException If there is any error creating the new sticker set
*/
public abstract Boolean createNewStickerSet(CreateNewStickerSet createNewStickerSet) throws TelegramApiException;
/**
* Upload a new file as sticker (https://core.telegram.org/bots/api#uploadStickerFile)
* @param uploadStickerFile Information of the file to upload as sticker
* @return If success, true is returned
* @throws TelegramApiException If there is any error uploading the new file
*/
public abstract File uploadStickerFile(UploadStickerFile uploadStickerFile) throws TelegramApiException;
// Simplified methods // Simplified methods
protected abstract <T extends Serializable, Method extends BotApiMethod<T>, Callback extends SentCallback<T>> void sendApiMethodAsync(Method method, Callback callback); protected abstract <T extends Serializable, Method extends BotApiMethod<T>, Callback extends SentCallback<T>> void sendApiMethodAsync(Method method, Callback callback);

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>3.1.2</version> <version>3.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Telegram Bots</name> <name>Telegram Bots</name>
@ -66,7 +66,7 @@
<jackson.version>2.8.7</jackson.version> <jackson.version>2.8.7</jackson.version>
<jacksonanotation.version>2.8.0</jacksonanotation.version> <jacksonanotation.version>2.8.0</jacksonanotation.version>
<commonio.version>2.5</commonio.version> <commonio.version>2.5</commonio.version>
<bots.version>3.1.2</bots.version> <bots.version>3.2</bots.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>

View File

@ -17,6 +17,9 @@ import org.apache.http.util.EntityUtils;
import org.telegram.telegrambots.api.methods.BotApiMethod; import org.telegram.telegrambots.api.methods.BotApiMethod;
import org.telegram.telegrambots.api.methods.groupadministration.SetChatPhoto; import org.telegram.telegrambots.api.methods.groupadministration.SetChatPhoto;
import org.telegram.telegrambots.api.methods.send.*; import org.telegram.telegrambots.api.methods.send.*;
import org.telegram.telegrambots.api.methods.stickers.AddStickerToSet;
import org.telegram.telegrambots.api.methods.stickers.CreateNewStickerSet;
import org.telegram.telegrambots.api.methods.stickers.UploadStickerFile;
import org.telegram.telegrambots.api.objects.File; import org.telegram.telegrambots.api.objects.File;
import org.telegram.telegrambots.api.objects.Message; import org.telegram.telegrambots.api.objects.Message;
import org.telegram.telegrambots.exceptions.TelegramApiException; import org.telegram.telegrambots.exceptions.TelegramApiException;
@ -478,6 +481,100 @@ public abstract class DefaultAbsSender extends AbsSender {
} }
} }
@Override
public Boolean addStickerToSet(AddStickerToSet addStickerToSet) throws TelegramApiException {
assertParamNotNull(addStickerToSet, "addStickerToSet");
addStickerToSet.validate();
try {
String url = getBaseUrl() + AddStickerToSet.PATH;
HttpPost httppost = configuredHttpPost(url);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(AddStickerToSet.USERID_FIELD, addStickerToSet.getUserId().toString(), TEXT_PLAIN_CONTENT_TYPE);
builder.addTextBody(AddStickerToSet.NAME_FIELD, addStickerToSet.getName(), TEXT_PLAIN_CONTENT_TYPE);
builder.addTextBody(AddStickerToSet.EMOJIS_FIELD, addStickerToSet.getEmojis(), TEXT_PLAIN_CONTENT_TYPE);
if (addStickerToSet.isNewPngSticker()) {
if (addStickerToSet.getPngStickerFile() != null) {
builder.addBinaryBody(AddStickerToSet.PNGSTICKER_FIELD, addStickerToSet.getPngStickerFile());
} else if (addStickerToSet.getPngStickerStream() != null) {
builder.addBinaryBody(AddStickerToSet.PNGSTICKER_FIELD, addStickerToSet.getPngStickerStream(), ContentType.APPLICATION_OCTET_STREAM, addStickerToSet.getPngStickerName());
} else {
builder.addBinaryBody(AddStickerToSet.PNGSTICKER_FIELD, new java.io.File(addStickerToSet.getPngSticker()), ContentType.create("image/png"), addStickerToSet.getPngStickerName());
}
} else {
builder.addTextBody(AddStickerToSet.PNGSTICKER_FIELD, addStickerToSet.getPngSticker());
}
if (addStickerToSet.getMaskPosition() != null) {
builder.addTextBody(AddStickerToSet.MASKPOSITION_FIELD, objectMapper.writeValueAsString(addStickerToSet.getMaskPosition()), TEXT_PLAIN_CONTENT_TYPE);
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
return addStickerToSet.deserializeResponse(sendHttpPostRequest(httppost));
} catch (IOException e) {
throw new TelegramApiException("Unable to add sticker to set", e);
}
}
@Override
public Boolean createNewStickerSet(CreateNewStickerSet createNewStickerSet) throws TelegramApiException {
assertParamNotNull(createNewStickerSet, "createNewStickerSet");
createNewStickerSet.validate();
try {
String url = getBaseUrl() + CreateNewStickerSet.PATH;
HttpPost httppost = configuredHttpPost(url);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(CreateNewStickerSet.USERID_FIELD, createNewStickerSet.getUserId().toString(), TEXT_PLAIN_CONTENT_TYPE);
builder.addTextBody(CreateNewStickerSet.NAME_FIELD, createNewStickerSet.getName(), TEXT_PLAIN_CONTENT_TYPE);
builder.addTextBody(CreateNewStickerSet.TITLE_FIELD, createNewStickerSet.getTitle(), TEXT_PLAIN_CONTENT_TYPE);
builder.addTextBody(CreateNewStickerSet.EMOJIS_FIELD, createNewStickerSet.getEmojis(), TEXT_PLAIN_CONTENT_TYPE);
builder.addTextBody(CreateNewStickerSet.CONTAINSMASKS_FIELD, createNewStickerSet.getContainsMasks().toString());
if (createNewStickerSet.isNewPngSticker()) {
if (createNewStickerSet.getPngStickerFile() != null) {
builder.addBinaryBody(CreateNewStickerSet.PNGSTICKER_FIELD, createNewStickerSet.getPngStickerFile());
} else if (createNewStickerSet.getPngStickerStream() != null) {
builder.addBinaryBody(CreateNewStickerSet.PNGSTICKER_FIELD, createNewStickerSet.getPngStickerStream(), ContentType.APPLICATION_OCTET_STREAM, createNewStickerSet.getPngStickerName());
} else {
builder.addBinaryBody(CreateNewStickerSet.PNGSTICKER_FIELD, new java.io.File(createNewStickerSet.getPngSticker()), ContentType.create("image/png"), createNewStickerSet.getPngStickerName());
}
} else {
builder.addTextBody(CreateNewStickerSet.PNGSTICKER_FIELD, createNewStickerSet.getPngSticker());
}
if (createNewStickerSet.getMaskPosition() != null) {
builder.addTextBody(CreateNewStickerSet.MASKPOSITION_FIELD, objectMapper.writeValueAsString(createNewStickerSet.getMaskPosition()), TEXT_PLAIN_CONTENT_TYPE);
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
return createNewStickerSet.deserializeResponse(sendHttpPostRequest(httppost));
} catch (IOException e) {
throw new TelegramApiException("Unable to create new sticker set", e);
}
}
@Override
public File uploadStickerFile(UploadStickerFile uploadStickerFile) throws TelegramApiException {
assertParamNotNull(uploadStickerFile, "uploadStickerFile");
uploadStickerFile.validate();
try {
String url = getBaseUrl() + UploadStickerFile.PATH;
HttpPost httppost = configuredHttpPost(url);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(UploadStickerFile.USERID_FIELD, uploadStickerFile.getUserId().toString(), TEXT_PLAIN_CONTENT_TYPE);
if (uploadStickerFile.getNewPngStickerFile() != null) {
builder.addBinaryBody(UploadStickerFile.PNGSTICKER_FIELD, uploadStickerFile.getNewPngStickerFile());
} else if (uploadStickerFile.getNewPngStickerStream() != null) {
builder.addBinaryBody(UploadStickerFile.PNGSTICKER_FIELD, uploadStickerFile.getNewPngStickerStream(), ContentType.APPLICATION_OCTET_STREAM, uploadStickerFile.getNewPngStickerName());
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
return uploadStickerFile.deserializeResponse(sendHttpPostRequest(httppost));
} catch (IOException e) {
throw new TelegramApiException("Unable to upload new sticker file", e);
}
}
// Simplified methods // Simplified methods
@Override @Override