diff --git a/README.md b/README.md
index ece85637..22226771 100644
--- a/README.md
+++ b/README.md
@@ -27,18 +27,18 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambots
- 5.6.0
+ 5.7.1
```
2. Using Gradle:
```gradle
- implementation 'org.telegram:telegrambots:5.6.0'
+ implementation 'org.telegram:telegrambots:5.7.1'
```
- 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.6.0)
- 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.6.0)
+ 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.7.1)
+ 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.7.1)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
diff --git a/TelegramBots.wiki/Changelog.md b/TelegramBots.wiki/Changelog.md
index 707ca82e..58d149a2 100644
--- a/TelegramBots.wiki/Changelog.md
+++ b/TelegramBots.wiki/Changelog.md
@@ -1,3 +1,7 @@
+### 5.7.1 ###
+1. Update Api version [5.7](https://core.telegram.org/bots/api-changelog#january-31-2022)
+2. Bug Fixing: #1023
+
### 5.6.0 ###
1. Update Api version [5.6](https://core.telegram.org/bots/api-changelog#december-30-2021)
diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md
index d7197a55..609dc1f5 100644
--- a/TelegramBots.wiki/Getting-Started.md
+++ b/TelegramBots.wiki/Getting-Started.md
@@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss
org.telegram
telegrambots
- 5.6.0
+ 5.7.1
```
* With **Gradle**:
```gradle
- implementation 'org.telegram:telegrambots:5.6.0'
+ implementation 'org.telegram:telegrambots:5.7.1'
```
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md
index 41ae3175..10107cd7 100644
--- a/TelegramBots.wiki/abilities/Simple-Example.md
+++ b/TelegramBots.wiki/abilities/Simple-Example.md
@@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
org.telegram
telegrambots-abilities
- 5.6.0
+ 5.7.1
```
* **Gradle**
```gradle
- implementation 'org.telegram:telegrambots-abilities:5.6.0'
+ implementation 'org.telegram:telegrambots-abilities:5.7.1'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)
diff --git a/pom.xml b/pom.xml
index dfda7fa3..6d6f8a45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
pom
- 5.6.0
+ 5.7.1
telegrambots
diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md
index b32575c8..b1ddbb29 100644
--- a/telegrambots-abilities/README.md
+++ b/telegrambots-abilities/README.md
@@ -18,14 +18,14 @@ Usage
org.telegram
telegrambots-abilities
- 5.6.0
+ 5.7.1
```
**Gradle**
```gradle
- implementation 'org.telegram:telegrambots-abilities:5.6.0'
+ implementation 'org.telegram:telegrambots-abilities:5.7.1'
```
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1)
diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml
index 3583ca1a..55cd5e16 100644
--- a/telegrambots-abilities/pom.xml
+++ b/telegrambots-abilities/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.6.0
+ 5.7.1
telegrambots-abilities
@@ -84,7 +84,7 @@
org.telegram
telegrambots
- 5.6.0
+ 5.7.1
org.apache.commons
diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md
index b958abdb..fbc3d296 100644
--- a/telegrambots-chat-session-bot/README.md
+++ b/telegrambots-chat-session-bot/README.md
@@ -15,14 +15,14 @@ Usage
org.telegram
telegrambots-chat-session-bot
- 5.6.0
+ 5.7.1
```
**Gradle**
```gradle
- implementation 'org.telegram:telegrambots-chat-session-bot:5.6.0'
+ implementation 'org.telegram:telegrambots-chat-session-bot:5.7.1'
```
Motivation
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index 9d71f0d2..569b73e8 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.6.0
+ 5.7.1
telegrambots-chat-session-bot
@@ -84,7 +84,7 @@
org.telegram
telegrambots
- 5.6.0
+ 5.7.1
diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md
index addb5b6c..56b8aac5 100644
--- a/telegrambots-extensions/README.md
+++ b/telegrambots-extensions/README.md
@@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambotsextensions
- 5.6.0
+ 5.7.1
```
2. Using Gradle:
```gradle
- implementation 'org.telegram:telegrambotsextensions:5.6.0'
+ implementation 'org.telegram:telegrambotsextensions:5.7.1'
```
\ No newline at end of file
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index c5e653a2..32300d93 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.6.0
+ 5.7.1
telegrambotsextensions
@@ -75,7 +75,7 @@
org.telegram
telegrambots
- 5.6.0
+ 5.7.1
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index d7f60a5b..e1b25ec3 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.6.0
+ 5.7.1
telegrambots-meta
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java
index a9e692f9..b8b2b4e6 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java
@@ -23,7 +23,8 @@ import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
- * Use this method to send .webp stickers. On success, the sent Message is returned.
+ * Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
+ * On success, the sent Message is returned.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@@ -83,14 +84,10 @@ public class SendSticker extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (chatId == null || chatId.isEmpty()) {
+ if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
- if (sticker == null) {
- throw new TelegramApiValidationException("Sticker parameter can't be empty", this);
- }
-
sticker.validate();
if (replyMarkup != null) {
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java
index bbe032ae..6b021678 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java
@@ -22,11 +22,9 @@ import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
- * Use this method to add a new sticker to a set created by the bot.
- * You must use exactly one of the fields png_sticker or tgs_sticker.
- * Animated stickers can be added to animated sticker sets and only to them.
- * Animated sticker sets can have up to 50 stickers.
- * Static sticker sets can have up to 120 stickers.
+ * Use this method to create a new sticker set owned by a user.
+ * The bot will be able to edit the sticker set thus created.
+ * You must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker.
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@@ -44,6 +42,7 @@ public class AddStickerToSet extends PartialBotApiMethod {
public static final String NAME_FIELD = "name";
public static final String PNGSTICKER_FIELD = "png_sticker";
public static final String TGSSTICKER_FIELD = "tgs_sticker";
+ public static final String WEBMSTICKER_FIELD = "webm_sticker";
public static final String EMOJIS_FIELD = "emojis";
public static final String MASKPOSITION_FIELD = "mask_position";
@@ -69,6 +68,13 @@ public class AddStickerToSet extends PartialBotApiMethod {
*/
private InputFile tgsSticker;
+ /**
+ * Optional.
+ * WEBM video with the sticker, uploaded using multipart/form-data.
+ * See https://core.telegram.org/stickers#video-stickers for technical requirements
+ */
+ private InputFile webmSticker;
+
@Override
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
@@ -86,31 +92,37 @@ public class AddStickerToSet extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (userId == null || userId <= 0) {
+ if (userId <= 0) {
throw new TelegramApiValidationException("userId can't be empty", this);
}
- if (name == null || name.isEmpty()) {
+ if (name.isEmpty()) {
throw new TelegramApiValidationException("name can't be empty", this);
}
- if (emojis == null || emojis.isEmpty()) {
+ if (emojis.isEmpty()) {
throw new TelegramApiValidationException("emojis can't be empty", this);
}
- if (pngSticker == null && tgsSticker == null) {
- throw new TelegramApiValidationException("One of pngSticker or tgsSticker is needed", this);
+ if (pngSticker == null && tgsSticker == null && webmSticker == null) {
+ throw new TelegramApiValidationException("One of pngSticker, tgsSticker or webmSticker is needed", this);
}
- if (pngSticker != null && tgsSticker != null) {
- throw new TelegramApiValidationException("Only one of pngSticker or tgsSticker are allowed", this);
+ if ((pngSticker != null && tgsSticker != null) || (pngSticker != null && webmSticker != null) ||
+ (tgsSticker != null && webmSticker != null)) {
+ throw new TelegramApiValidationException("Only one of pngSticker, tgsSticker or webmSticker are allowed", this);
}
if (pngSticker != null) {
pngSticker.validate();
}
+
if (tgsSticker != null) {
tgsSticker.validate();
}
+ if (webmSticker != null) {
+ webmSticker.validate();
+ }
+
if (maskPosition != null) {
maskPosition.validate();
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java
index 05232f2a..58b180fa 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java
@@ -22,8 +22,9 @@ import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
- * Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created.
- * You must use exactly one of the fields png_sticker or tgs_sticker.
+ * Use this method to create a new sticker set owned by a user.
+ * The bot will be able to edit the sticker set thus created.
+ * You must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker.
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@@ -42,6 +43,7 @@ public class CreateNewStickerSet extends PartialBotApiMethod {
public static final String TITLE_FIELD = "title";
public static final String PNGSTICKER_FIELD = "png_sticker";
public static final String TGSSTICKER_FIELD = "tgs_sticker";
+ public static final String WEBMSTICKER_FIELD = "webm_sticker";
public static final String EMOJIS_FIELD = "emojis";
public static final String CONTAINSMASKS_FIELD = "contains_masks";
public static final String MASKPOSITION_FIELD = "mask_position";
@@ -73,12 +75,19 @@ public class CreateNewStickerSet extends PartialBotApiMethod {
private InputFile pngSticker;
/**
- * @Optional
+ * Optional
* TGS animation with the sticker, uploaded using multipart/form-data.
* See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements
*/
private InputFile tgsSticker;
+ /**
+ * Optional
+ * WEBM video with the sticker, uploaded using multipart/form-data.
+ * See https://core.telegram.org/stickers#video-stickers for technical requirements
+ */
+ private InputFile webmSticker;
+
@Override
public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
@@ -96,34 +105,40 @@ public class CreateNewStickerSet extends PartialBotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (userId == null || userId <= 0) {
+ if (userId <= 0) {
throw new TelegramApiValidationException("userId can't be empty", this);
}
- if (name == null || name.isEmpty()) {
+ if (name.isEmpty()) {
throw new TelegramApiValidationException("name can't be empty", this);
}
- if (title == null || title.isEmpty()) {
+ if (title.isEmpty()) {
throw new TelegramApiValidationException("title can't be empty", this);
}
- if (emojis == null || emojis.isEmpty()) {
+ if (emojis.isEmpty()) {
throw new TelegramApiValidationException("emojis can't be empty", this);
}
- if (pngSticker == null && tgsSticker == null) {
- throw new TelegramApiValidationException("One of pngSticker or tgsSticker is needed", this);
+ if (pngSticker == null && tgsSticker == null && webmSticker == null) {
+ throw new TelegramApiValidationException("One of pngSticker, tgsSticker or webmSticker is needed", this);
}
- if (pngSticker != null && tgsSticker != null) {
- throw new TelegramApiValidationException("Only one of pngSticker or tgsSticker are allowed", this);
+ if ((pngSticker != null && tgsSticker != null) || (pngSticker != null && webmSticker != null)
+ || (tgsSticker != null && webmSticker != null)) {
+ throw new TelegramApiValidationException("Only one of pngSticker, tgsSticker or webmSticker are allowed", this);
}
if (pngSticker != null) {
pngSticker.validate();
}
+
if (tgsSticker != null) {
tgsSticker.validate();
}
+ if (webmSticker != null) {
+ webmSticker.validate();
+ }
+
if (maskPosition != null) {
maskPosition.validate();
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/SetStickerSetThumb.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/SetStickerSetThumb.java
index c37e74fa..dd4f8b40 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/SetStickerSetThumb.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/SetStickerSetThumb.java
@@ -20,7 +20,8 @@ import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
- * Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only.
+ * Use this method to set the thumbnail of a sticker set.
+ * Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only.
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@@ -42,14 +43,17 @@ public class SetStickerSetThumb extends BotApiMethod {
@NonNull
private Long userId; ///< User identifier of the sticker set owner
/**
+ * Optional.
* A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px,
* or a TGS animation with the thumbnail up to 32 kilobytes in size;
- * see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical requirements.
- * 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.
+ * see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements,
+ * or a WEBM video with the thumbnail up to 32 kilobytes in size;
+ * see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements.
+ * 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 ยป.
* Animated sticker set thumbnail can't be uploaded via HTTP URL.
*/
- @NonNull
private InputFile thumb;
@Override
@@ -74,15 +78,14 @@ public class SetStickerSetThumb extends BotApiMethod {
@Override
public void validate() throws TelegramApiValidationException {
- if (name == null || name.isEmpty()) {
+ if (name.isEmpty()) {
throw new TelegramApiValidationException("name can't be null", this);
}
- if (userId == null || userId == 0) {
+ if (userId <= 0) {
throw new TelegramApiValidationException("userId can't be null", this);
}
- if (thumb == null) {
- throw new TelegramApiValidationException("thumb can't be null", this);
+ if (thumb != null) {
+ thumb.validate();
}
- thumb.validate();
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/Sticker.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/Sticker.java
index 2dc8b003..e8848010 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/Sticker.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/Sticker.java
@@ -33,6 +33,7 @@ public class Sticker implements BotApiObject {
private static final String SETNAME_FIELD = "set_name";
private static final String MASKPOSITON_FIELD = "mask_position";
private static final String ISANIMATED_FIELD = "is_animated";
+ private static final String ISVIDEO_FIELD = "is_video";
@JsonProperty(FILEID_FIELD)
private String fileId; ///< Identifier for this file, which can be used to download or reuse the file
@@ -58,4 +59,6 @@ public class Sticker implements BotApiObject {
private MaskPosition maskPosition; ///< Optional. For mask stickers, the position where the mask should be placed
@JsonProperty(ISANIMATED_FIELD)
private Boolean isAnimated; ///< True, if the sticker is animated
+ @JsonProperty(ISVIDEO_FIELD)
+ private Boolean isVideo; ///< True, if the sticker is a video sticker
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/StickerSet.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/StickerSet.java
index 2f227f0b..a144f359 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/StickerSet.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/stickers/StickerSet.java
@@ -29,6 +29,7 @@ public class StickerSet implements BotApiObject {
private static final String CONTAINSMASKS_FIELD = "contains_masks";
private static final String STICKERS_FIELD = "stickers";
private static final String ISANIMATED_FIELD = "is_animated";
+ private static final String ISVIDEO_FIELD = "is_video";
private static final String THUMB_FIELD = "thumb";
@JsonProperty(NAME_FIELD)
@@ -41,6 +42,8 @@ public class StickerSet implements BotApiObject {
private List stickers; ///< True, if the sticker set contains masks
@JsonProperty(ISANIMATED_FIELD)
private Boolean isAnimated; ///< List of all set stickers
+ @JsonProperty(ISVIDEO_FIELD)
+ private Boolean isVideo; ///< True, if the sticker set contains video stickers
@JsonProperty(THUMB_FIELD)
- private PhotoSize thumb; ///< Optional. Sticker set thumbnail in the .WEBP or .TGS format
+ private PhotoSize thumb; ///< Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
}
diff --git a/telegrambots-spring-boot-starter/README.md b/telegrambots-spring-boot-starter/README.md
index a45c787b..78f01e7a 100644
--- a/telegrambots-spring-boot-starter/README.md
+++ b/telegrambots-spring-boot-starter/README.md
@@ -18,14 +18,14 @@ Usage
org.telegram
telegrambots-spring-boot-starter
- 5.6.0
+ 5.7.1
```
**Gradle**
```gradle
- implementation 'org.telegram:telegrambots-spring-boot-starter:5.6.0'
+ implementation 'org.telegram:telegrambots-spring-boot-starter:5.7.1'
```
Motivation
diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml
index f1ae4f93..a2e0c1f9 100644
--- a/telegrambots-spring-boot-starter/pom.xml
+++ b/telegrambots-spring-boot-starter/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.6.0
+ 5.7.1
telegrambots-spring-boot-starter
@@ -70,7 +70,7 @@
UTF-8
UTF-8
- 5.6.0
+ 5.7.1
2.5.8
1.6
diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml
index 2040451c..c7f62987 100644
--- a/telegrambots/pom.xml
+++ b/telegrambots/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.6.0
+ 5.7.1
telegrambots
@@ -92,7 +92,7 @@
org.telegram
telegrambots-meta
- 5.6.0
+ 5.7.1
org.projectlombok
@@ -110,6 +110,12 @@
com.fasterxml.jackson.module
jackson-module-jaxb-annotations
+
+
+ jakarta.activation
+ jakarta.activation-api
+
+
com.fasterxml.jackson.core
diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java
index 8822f710..2564e4fc 100644
--- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java
+++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java
@@ -613,8 +613,10 @@ public abstract class DefaultAbsSender extends AbsSender {
builder.addTextBody(AddStickerToSet.EMOJIS_FIELD, addStickerToSet.getEmojis(), TEXT_PLAIN_CONTENT_TYPE);
if (addStickerToSet.getPngSticker() != null) {
addInputFile(builder, addStickerToSet.getPngSticker(), AddStickerToSet.PNGSTICKER_FIELD, true);
- } else {
+ } else if (addStickerToSet.getTgsSticker() != null) {
addInputFile(builder, addStickerToSet.getTgsSticker(), AddStickerToSet.TGSSTICKER_FIELD, true);
+ } else {
+ addInputFile(builder, addStickerToSet.getWebmSticker(), AddStickerToSet.WEBMSTICKER_FIELD, true);
}
if (addStickerToSet.getMaskPosition() != null) {
@@ -641,7 +643,9 @@ public abstract class DefaultAbsSender extends AbsSender {
builder.setCharset(StandardCharsets.UTF_8);
builder.addTextBody(SetStickerSetThumb.USERID_FIELD, setStickerSetThumb.getUserId().toString(), TEXT_PLAIN_CONTENT_TYPE);
builder.addTextBody(SetStickerSetThumb.NAME_FIELD, setStickerSetThumb.getName(), TEXT_PLAIN_CONTENT_TYPE);
- addInputFile(builder, setStickerSetThumb.getThumb(), SetStickerSetThumb.THUMB_FIELD, true);
+ if (setStickerSetThumb.getThumb() != null) {
+ addInputFile(builder, setStickerSetThumb.getThumb(), SetStickerSetThumb.THUMB_FIELD, true);
+ }
HttpEntity multipart = builder.build();
httppost.setEntity(multipart);
@@ -668,8 +672,10 @@ public abstract class DefaultAbsSender extends AbsSender {
builder.addTextBody(CreateNewStickerSet.CONTAINSMASKS_FIELD, createNewStickerSet.getContainsMasks().toString(), TEXT_PLAIN_CONTENT_TYPE);
if (createNewStickerSet.getPngSticker() != null) {
addInputFile(builder, createNewStickerSet.getPngSticker(), CreateNewStickerSet.PNGSTICKER_FIELD, true);
- } else {
+ } else if (createNewStickerSet.getTgsSticker() != null) {
addInputFile(builder, createNewStickerSet.getTgsSticker(), CreateNewStickerSet.TGSSTICKER_FIELD, true);
+ } else {
+ addInputFile(builder, createNewStickerSet.getWebmSticker(), CreateNewStickerSet.WEBMSTICKER_FIELD, true);
}
if (createNewStickerSet.getMaskPosition() != null) {