Merge pull request #518 from rubenlagus/dev

Dev
This commit is contained in:
Ruben Bermudez 2018-08-30 19:29:25 +01:00 committed by GitHub
commit ffc1f713dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 438 additions and 34 deletions

View File

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

View File

@ -1,4 +1,8 @@
### <a id="4.0.0"></a>4.0.0 ###
### <a id="4.1"></a>4.1 ###
1. Support for Api Version [4.1](https://core.telegram.org/bots/api-changelog#august-27-2018)
2. Fix #507 and #512
### <a id="4.0.1"></a>4.0.1 ###
1. Fix bug #499
### <a id="4.0.0"></a>4.0.0 ###

View File

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

View File

@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```
* **Gradle**
```groovy
compile group: 'org.telegram', name: 'telegrambots-abilties', version: '4.0.1'
compile group: 'org.telegram', name: 'telegrambots-abilties', version: '4.1'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)

View File

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

View File

@ -18,19 +18,19 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```
**Gradle**
```gradle
compile "org.telegram:telegrambots-abilities:4.0.1"
compile "org.telegram:telegrambots-abilities:4.1"
```
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.0.1)
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.1)
**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.0.1)
**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.1)
Motivation
----------

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Ability Bot</name>
@ -65,7 +65,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
<commonslang.version>3.5</commonslang.version>
<mapdb.version>3.0.4</mapdb.version>
<guava.version>19.0</guava.version>

View File

@ -15,7 +15,7 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Bots Chat Session Bot</name>
@ -65,7 +65,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
<shiro.version>1.4.0</shiro.version>
</properties>

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ public class SendAnimation extends PartialBotApiMethod<Message> {
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.
private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message
private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
private String parseMode; ///< Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
/**
* Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
* A thumbnails width and height should not exceed 90.

View File

@ -9,6 +9,7 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
* @version 1.0
* This object represents a Telegram chat with an user or a group
*/
@SuppressWarnings("WeakerAccess")
public class Chat implements BotApiObject {
private static final String ID_FIELD = "id";
@ -64,7 +65,7 @@ public class Chat implements BotApiObject {
@JsonProperty(STICKERSETNAME_FIELD)
private String stickerSetName; ///< Optional. For supergroups, name of Group sticker set. Returned only in getChat.
@JsonProperty(CANSETSTICKERSET_FIELD)
private Message canSetStickerSet; ///< Optional. True, if the bot can change group the sticker set. Returned only in getChat.
private Boolean canSetStickerSet; ///< Optional. True, if the bot can change group the sticker set. Returned only in getChat.
public Chat() {
super();
@ -130,7 +131,7 @@ public class Chat implements BotApiObject {
return stickerSetName;
}
public Message getCanSetStickerSet() {
public Boolean getCanSetStickerSet() {
return canSetStickerSet;
}

View File

@ -3,6 +3,7 @@ package org.telegram.telegrambots.meta.api.objects.passport;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import java.util.ArrayList;
import java.util.List;
/**
@ -20,6 +21,8 @@ public class EncryptedPassportElement implements BotApiObject {
private static final String FRONTSIDE_FIELD = "front_side";
private static final String REVERSESIDE_FIELD = "reverse_side";
private static final String SELFIE_FIELD = "selfie";
private static final String TRANSLATION_FIELD = "translation";
private static final String HASH_FIELD = "hash";
/**
* Data type. One of personal_details, passport, driver_license, identity_card, internal_passport,
@ -68,6 +71,19 @@ public class EncryptedPassportElement implements BotApiObject {
*/
@JsonProperty(SELFIE_FIELD)
private PassportFile selfie;
/**
* Optional. Array of encrypted files with translated versions of documents provided by the user.
* Available if requested for passport, driver_license, identity_card, internal_passport,
* utility_bill, bank_statement, rental_agreement, passport_registration and temporary_registration types.
* Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
@JsonProperty(TRANSLATION_FIELD)
private ArrayList<PassportFile> translations;
/**
* Base64-encoded element hash for using in PassportElementErrorUnspecified
*/
@JsonProperty(HASH_FIELD)
private String hash;
public EncryptedPassportElement(String type, String data, String phoneNumber, String email, List<PassportFile> files,
PassportFile frontSide, PassportFile reverseSide, PassportFile selfie) {
@ -116,6 +132,18 @@ public class EncryptedPassportElement implements BotApiObject {
return selfie;
}
public String getHash() {
return hash;
}
public boolean hasTranslations() {
return translations != null && !translations.isEmpty();
}
public ArrayList<PassportFile> getTranslations() {
return translations;
}
@Override
public String toString() {
return "EncryptedPassportElement{" +
@ -127,6 +155,8 @@ public class EncryptedPassportElement implements BotApiObject {
", frontSide=" + frontSide +
", reverseSide=" + reverseSide +
", selfie=" + selfie +
", translations=" + translations +
", hash='" + hash + '\'' +
'}';
}
}

View File

@ -15,6 +15,9 @@ import org.telegram.telegrambots.meta.api.interfaces.Validable;
* PassportElementErrorSelfie
* PassportElementErrorFile
* PassportElementErrorFiles
* PassportElementErrorUnspecified
* PassportElementErrorTranslationFile
* PassportElementErrorTranslationFiles
*/
public interface PassportElementError extends InputBotApiObject, Validable {
}

View File

@ -0,0 +1,99 @@
package org.telegram.telegrambots.meta.api.objects.passport.dataerror;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 4.1
*
* Represents an issue with one of the files that constitute the translation of a document.
* The error is considered resolved when the file changes.
*/
public class PassportElementErrorTranslationFile implements PassportElementError {
private static final String SOURCE_FIELD = "source";
private static final String TYPE_FIELD = "type";
private static final String FILEHASH_FIELD = "file_hash";
private static final String MESSAGE_FIELD = "message";
@JsonProperty(SOURCE_FIELD)
private final String source = "translation_file"; ///< Error source, must be translation_file
/**
* Type of element of the user's Telegram Passport which has the issue, one of passport, driver_license,
* identity_card, internal_passport, utility_bill, bank_statement, rental_agreement,
* passport_registration, temporary_registration
*/
@JsonProperty(TYPE_FIELD)
private String type;
@JsonProperty(FILEHASH_FIELD)
private String fileHash; ///< Base64-encoded file hash
@JsonProperty(MESSAGE_FIELD)
private String message; ///< Error message
public PassportElementErrorTranslationFile() {
super();
}
public PassportElementErrorTranslationFile(String type, String fileHash, String message) {
super();
this.type = checkNotNull(type);
this.fileHash = checkNotNull(fileHash);
this.message = checkNotNull(message);
}
public String getType() {
return type;
}
public PassportElementErrorTranslationFile setType(String type) {
this.type = checkNotNull(type);
return this;
}
public String getSource() {
return source;
}
public String getFileHash() {
return fileHash;
}
public PassportElementErrorTranslationFile setFileHash(String fileHash) {
this.fileHash = fileHash;
return this;
}
public String getMessage() {
return message;
}
public PassportElementErrorTranslationFile setMessage(String message) {
this.message = checkNotNull(message);
return this;
}
@Override
public void validate() throws TelegramApiValidationException {
if (fileHash == null || fileHash.isEmpty()) {
throw new TelegramApiValidationException("File hash parameter can't be empty", this);
}
if (message == null || message.isEmpty()) {
throw new TelegramApiValidationException("Message parameter can't be empty", this);
}
if (type == null || type.isEmpty()) {
throw new TelegramApiValidationException("Type parameter can't be empty", this);
}
}
@Override
public String toString() {
return "PassportElementErrorTranslationFile{" +
"source='" + source + '\'' +
", type='" + type + '\'' +
", fileHash='" + fileHash + '\'' +
", message='" + message + '\'' +
'}';
}
}

View File

@ -0,0 +1,111 @@
package org.telegram.telegrambots.meta.api.objects.passport.dataerror;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 4.1
*
* Represents an issue with the translated version of a document.
* The error is considered resolved when a file with the document translation change.
*/
public class PassportElementErrorTranslationFiles implements PassportElementError {
private static final String SOURCE_FIELD = "source";
private static final String TYPE_FIELD = "type";
private static final String FILEHASHES_FIELD = "file_hashes";
private static final String MESSAGE_FIELD = "message";
@JsonProperty(SOURCE_FIELD)
private final String source = "translation_files"; ///< Error source, must be translation_files
/**
* Type of element of the user's Telegram Passport which has the issue, one of passport, driver_license,
* identity_card, internal_passport, utility_bill, bank_statement, rental_agreement,
* passport_registration, temporary_registration
*/
@JsonProperty(TYPE_FIELD)
private String type;
@JsonProperty(FILEHASHES_FIELD)
private List<String> fileHashes; ///< List of base64-encoded file hashes
@JsonProperty(MESSAGE_FIELD)
private String message; ///< Error message
public PassportElementErrorTranslationFiles() {
super();
}
public PassportElementErrorTranslationFiles(String type, List<String> fileHashes, String message) {
super();
this.type = checkNotNull(type);
this.fileHashes = checkNotNull(fileHashes);
this.message = checkNotNull(message);
}
public String getType() {
return type;
}
public PassportElementErrorTranslationFiles setType(String type) {
this.type = checkNotNull(type);
return this;
}
public String getSource() {
return source;
}
public List<String> getFileHashes() {
return fileHashes;
}
public PassportElementErrorTranslationFiles setFileHashes(List<String> fileHashes) {
this.fileHashes = checkNotNull(fileHashes);
return this;
}
public PassportElementErrorTranslationFiles addFileHash(String fileHash) {
fileHash = checkNotNull(fileHash);
if (fileHashes == null) {
fileHashes = new ArrayList<>();
}
fileHashes.add(fileHash);
return this;
}
public String getMessage() {
return message;
}
public PassportElementErrorTranslationFiles setMessage(String message) {
this.message = checkNotNull(message);
return this;
}
@Override
public void validate() throws TelegramApiValidationException {
if (fileHashes == null || fileHashes.isEmpty()) {
throw new TelegramApiValidationException("File hash parameter can't be empty", this);
}
if (message == null || message.isEmpty()) {
throw new TelegramApiValidationException("Message parameter can't be empty", this);
}
if (type == null || type.isEmpty()) {
throw new TelegramApiValidationException("Type parameter can't be empty", this);
}
}
@Override
public String toString() {
return "PassportElementErrorTranslationFiles{" +
"source='" + source + '\'' +
", type='" + type + '\'' +
", fileHashes=" + fileHashes +
", message='" + message + '\'' +
'}';
}
}

View File

@ -0,0 +1,97 @@
package org.telegram.telegrambots.meta.api.objects.passport.dataerror;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 4.1
*
* Represents an issue in an unspecified place.
* The error is considered resolved when new data is added.
*/
public class PassportElementErrorUnspecified implements PassportElementError {
private static final String SOURCE_FIELD = "source";
private static final String TYPE_FIELD = "type";
private static final String ELEMENTHASH_FIELD = "element_hash";
private static final String MESSAGE_FIELD = "message";
@JsonProperty(SOURCE_FIELD)
private final String source = "unspecified"; ///< Error source, must be unspecified
/**
* Type of element of the user's Telegram Passport which has the issue
*/
@JsonProperty(TYPE_FIELD)
private String type;
@JsonProperty(ELEMENTHASH_FIELD)
private String elementHash; ///< Base64-encoded element hash
@JsonProperty(MESSAGE_FIELD)
private String message; ///< Error message
public PassportElementErrorUnspecified() {
super();
}
public PassportElementErrorUnspecified(String type, String elementHash, String message) {
super();
this.type = checkNotNull(type);
this.elementHash = checkNotNull(elementHash);
this.message = checkNotNull(message);
}
public String getType() {
return type;
}
public PassportElementErrorUnspecified setType(String type) {
this.type = checkNotNull(type);
return this;
}
public String getSource() {
return source;
}
public String getElementHash() {
return elementHash;
}
public PassportElementErrorUnspecified setElementHash(String elementHash) {
this.elementHash = elementHash;
return this;
}
public String getMessage() {
return message;
}
public PassportElementErrorUnspecified setMessage(String message) {
this.message = checkNotNull(message);
return this;
}
@Override
public void validate() throws TelegramApiValidationException {
if (elementHash == null || elementHash.isEmpty()) {
throw new TelegramApiValidationException("Element hash parameter can't be empty", this);
}
if (message == null || message.isEmpty()) {
throw new TelegramApiValidationException("Message parameter can't be empty", this);
}
if (type == null || type.isEmpty()) {
throw new TelegramApiValidationException("Type parameter can't be empty", this);
}
}
@Override
public String toString() {
return "PassportElementErrorFile{" +
"source='" + source + '\'' +
", type='" + type + '\'' +
", elementHash='" + elementHash + '\'' +
", message='" + message + '\'' +
'}';
}
}

View File

@ -150,6 +150,14 @@ public abstract class AbsSender {
*/
public abstract Serializable execute(EditMessageMedia editMessageMedia) throws TelegramApiException;
/**
* Send animation
* @param sendAnimation Information of the animation
* @return Sent message
* @throws TelegramApiException If there is any error sending animation
*/
public abstract Message execute(SendAnimation sendAnimation) throws TelegramApiException;
// Simplified methods
protected abstract <T extends Serializable, Method extends BotApiMethod<T>, Callback extends SentCallback<T>> void sendApiMethodAsync(Method method, Callback callback);

View File

@ -18,14 +18,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-spring-boot-starter</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```
**Gradle**
```gradle
compile "org.telegram:telegrambots-spring-boot-starter:4.0.1"
compile "org.telegram:telegrambots-spring-boot-starter:4.1"
```
Motivation

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-spring-boot-starter</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Bots Spring Boot Starter</name>
@ -59,7 +59,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
<spring-boot.version>2.0.2.RELEASE</spring-boot.version>
</properties>

View File

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

View File

@ -636,6 +636,57 @@ public abstract class DefaultAbsSender extends AbsSender {
}
}
@Override
public Message execute(SendAnimation sendAnimation) throws TelegramApiException {
assertParamNotNull(sendAnimation, "sendAnimation");
sendAnimation.validate();
try {
String url = getBaseUrl() + SendVoice.PATH;
HttpPost httppost = configuredHttpPost(url);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setLaxMode();
builder.setCharset(StandardCharsets.UTF_8);
builder.addTextBody(SendAnimation.CHATID_FIELD, sendAnimation.getChatId(), TEXT_PLAIN_CONTENT_TYPE);
addInputFile(builder, sendAnimation.getAnimation(), SendAnimation.ANIMATION_FIELD, true);
if (sendAnimation.getReplyMarkup() != null) {
builder.addTextBody(SendAnimation.REPLYMARKUP_FIELD, objectMapper.writeValueAsString(sendAnimation.getReplyMarkup()), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getReplyToMessageId() != null) {
builder.addTextBody(SendAnimation.REPLYTOMESSAGEID_FIELD, sendAnimation.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getDisableNotification() != null) {
builder.addTextBody(SendAnimation.DISABLENOTIFICATION_FIELD, sendAnimation.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getDuration() != null) {
builder.addTextBody(SendAnimation.DURATION_FIELD, sendAnimation.getDuration().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getWidth() != null) {
builder.addTextBody(SendAnimation.WIDTH_FIELD, sendAnimation.getWidth().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getHeight() != null) {
builder.addTextBody(SendAnimation.HEIGHT_FIELD, sendAnimation.getHeight().toString(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getThumb() != null) {
addInputFile(builder, sendAnimation.getThumb(), SendAnimation.THUMB_FIELD, false);
builder.addTextBody(SendAnimation.THUMB_FIELD, sendAnimation.getThumb().getAttachName(), TEXT_PLAIN_CONTENT_TYPE);
}
if (sendAnimation.getCaption() != null) {
builder.addTextBody(SendAnimation.CAPTION_FIELD, sendAnimation.getCaption(), TEXT_PLAIN_CONTENT_TYPE);
if (sendAnimation.getParseMode() != null) {
builder.addTextBody(SendAnimation.PARSEMODE_FIELD, sendAnimation.getParseMode(), TEXT_PLAIN_CONTENT_TYPE);
}
}
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
return sendAnimation.deserializeResponse(sendHttpPostRequest(httppost));
} catch (IOException e) {
throw new TelegramApiException("Unable to edit message media", e);
}
}
// Simplified methods
@Override