From 3d07f27d41cc6227e2e78abf1922f9ac3e05f358 Mon Sep 17 00:00:00 2001 From: rubenlagus Date: Sat, 18 Jun 2022 15:47:08 +0200 Subject: [PATCH] Api version 6.1 --- .../java/org/telegram/telegrambots/util/WebhookUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java b/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java index b364e73f..3f26566f 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/util/WebhookUtils.java @@ -11,12 +11,10 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.util.EntityUtils; import org.json.JSONArray; import org.json.JSONException; -import org.json.JSONObject; import org.telegram.telegrambots.Constants; import org.telegram.telegrambots.bots.DefaultAbsSender; import org.telegram.telegrambots.bots.DefaultBotOptions; import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder; -import org.telegram.telegrambots.meta.ApiConstants; import org.telegram.telegrambots.meta.api.methods.updates.DeleteWebhook; import org.telegram.telegrambots.meta.api.methods.updates.SetWebhook; import org.telegram.telegrambots.meta.api.objects.InputFile; @@ -24,7 +22,6 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.generics.WebhookBot; -import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -77,6 +74,9 @@ public final class WebhookUtils { if (setWebhook.getDropPendingUpdates() != null) { builder.addTextBody(SetWebhook.DROPPENDINGUPDATES_FIELD, setWebhook.getDropPendingUpdates().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (setWebhook.getSecretToken() != null) { + builder.addTextBody(SetWebhook.SECRETTOKEN_FIELD, setWebhook.getSecretToken(), TEXT_PLAIN_CONTENT_TYPE); + } if (setWebhook.getCertificate() != null) { InputFile webhookFile = setWebhook.getCertificate(); if (webhookFile.getNewMediaFile() != null) {