From 09cdf87724e7e8ed623a79d5c40f52ac16aac3c3 Mon Sep 17 00:00:00 2001 From: Herindra Setiawan Date: Tue, 18 May 2021 13:56:11 +0700 Subject: [PATCH 1/2] Fix issue #920 Wrong API path for SetStickerSetThumb --- .../meta/api/methods/stickers/SetStickerSetThumb.java | 2 +- .../java/org/telegram/telegrambots/bots/DefaultAbsSender.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 62836002..c37e74fa 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 @@ -31,7 +31,7 @@ import java.io.IOException; @AllArgsConstructor @Builder public class SetStickerSetThumb extends BotApiMethod { - private static final String PATH = "setStickerSetThumb"; + public static final String PATH = "setStickerSetThumb"; public static final String NAME_FIELD = "name"; public static final String USERID_FIELD = "user_id"; 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 3d173e4f..9a855a84 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java @@ -610,7 +610,7 @@ public abstract class DefaultAbsSender extends AbsSender { assertParamNotNull(setStickerSetThumb, "setStickerSetThumb"); setStickerSetThumb.validate(); try { - String url = getBaseUrl() + AddStickerToSet.PATH; + String url = getBaseUrl() + SetStickerSetThumb.PATH; HttpPost httppost = configuredHttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setLaxMode(); From d315745f2e4ac2e8b36837460816fe3be9826c1b Mon Sep 17 00:00:00 2001 From: Herindra Setiawan Date: Tue, 18 May 2021 15:40:14 +0700 Subject: [PATCH 2/2] Change Exception error message to match the function --- .../java/org/telegram/telegrambots/bots/DefaultAbsSender.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9a855a84..4a2ebbca 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java @@ -623,7 +623,7 @@ public abstract class DefaultAbsSender extends AbsSender { return setStickerSetThumb.deserializeResponse(sendHttpPostRequest(httppost)); } catch (IOException e) { - throw new TelegramApiException("Unable to add sticker to set", e); + throw new TelegramApiException("Unable to set sticker set thumb", e); } }