diff --git a/Bots.ipr b/Bots.ipr index fa84a71b..1a6f7b10 100644 --- a/Bots.ipr +++ b/Bots.ipr @@ -20,6 +20,7 @@ + @@ -34,11 +35,12 @@ + - + @@ -409,7 +411,6 @@ - @@ -501,6 +502,7 @@ + @@ -747,6 +749,59 @@ + + @@ -1472,6 +1528,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 0e7e1639..e9feeea2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Just import add the library to your project with one of these options: org.telegram telegrambots - 3.6 + 3.6.1 ``` diff --git a/TelegramBots.wiki/Changelog.md b/TelegramBots.wiki/Changelog.md index 1509ad43..1e1bfa42 100644 --- a/TelegramBots.wiki/Changelog.md +++ b/TelegramBots.wiki/Changelog.md @@ -1,3 +1,8 @@ +### 3.6.1 ### +1. Support for proxy connections +2. New module for Spring +3. Bug fixing + ### 3.6 ### 1. Support for Api Version [3.6](https://core.telegram.org/bots/api-changelog#february-13-2018) 2. Bug fixing and other improvements diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md index da550b3f..96b06556 100644 --- a/TelegramBots.wiki/Getting-Started.md +++ b/TelegramBots.wiki/Getting-Started.md @@ -11,7 +11,7 @@ First you need ot get the library and add it to your project. There are few poss org.telegram telegrambots - 3.6 + 3.6.1 ``` * With **Gradle**: diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md index fbd08e7f..3e2419e3 100644 --- a/TelegramBots.wiki/abilities/Simple-Example.md +++ b/TelegramBots.wiki/abilities/Simple-Example.md @@ -9,7 +9,7 @@ As with any Java project, you will need to set your dependencies. org.telegram telegrambots-abilities - 3.6 + 3.6.1 ``` * **Gradle** diff --git a/pom.xml b/pom.xml index fe5346ee..4b5ea1dc 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots pom - 3.6 + 3.6.1 telegrambots @@ -27,6 +27,6 @@ true - 3.6 + 3.6.1 \ No newline at end of file diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md index 8b01640f..23a3aab2 100644 --- a/telegrambots-abilities/README.md +++ b/telegrambots-abilities/README.md @@ -18,7 +18,7 @@ Usage org.telegram telegrambots-abilities - 3.6 + 3.6.1 ``` diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml index c89607e7..716b8bd6 100644 --- a/telegrambots-abilities/pom.xml +++ b/telegrambots-abilities/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.telegram telegrambots-abilities - 3.6 + 3.6.1 jar Telegram Ability Bot @@ -65,7 +65,7 @@ UTF-8 UTF-8 - 3.6 + 3.6.1 3.5 3.0.4 19.0 diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md index 97dd6f2c..4e5a3d10 100644 --- a/telegrambots-extensions/README.md +++ b/telegrambots-extensions/README.md @@ -16,7 +16,7 @@ Just import add the library to your project with one of these options: org.telegram telegrambotsextensions - 3.6 + 3.6.1 ``` diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml index a6f41734..35d22cd6 100644 --- a/telegrambots-extensions/pom.xml +++ b/telegrambots-extensions/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.telegram telegrambotsextensions - 3.6 + 3.6.1 jar Telegram Bots Extensions @@ -59,7 +59,7 @@ UTF-8 UTF-8 - 3.6 + 3.6.1 diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml index 3bb47ed2..a37020bc 100644 --- a/telegrambots-meta/pom.xml +++ b/telegrambots-meta/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.telegram telegrambots-meta - 3.6 + 3.6.1 jar Telegram Bots Meta diff --git a/telegrambots-spring-boot-starter/README.md b/telegrambots-spring-boot-starter/README.md index 9d1c7910..8bb3f2a8 100644 --- a/telegrambots-spring-boot-starter/README.md +++ b/telegrambots-spring-boot-starter/README.md @@ -18,7 +18,7 @@ Usage org.telegram telegrambots-spring-boot-starter - 3.6 + 3.6.1 ``` diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml index 301ee6b1..b40ff9c9 100644 --- a/telegrambots-spring-boot-starter/pom.xml +++ b/telegrambots-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.telegram telegrambots-spring-boot-starter - 3.6 + 3.6.1 jar Telegram Bots Spring Boot Starter @@ -59,7 +59,7 @@ UTF-8 UTF-8 - 3.6 + 3.6.1 1.5.10.RELEASE diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml index cf56f9bb..95d1f3e3 100644 --- a/telegrambots/pom.xml +++ b/telegrambots/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.telegram telegrambots - 3.6 + 3.6.1 jar Telegram Bots @@ -66,7 +66,7 @@ 2.8.7 2.8.0 2.5 - 3.6 + 3.6.1 diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java b/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java index 25b99dfc..4ed163c7 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java @@ -1,25 +1,11 @@ package org.telegram.telegrambots.bots; -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.entity.BufferedHttpEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.json.JSONException; -import org.json.JSONObject; -import org.telegram.telegrambots.ApiConstants; import org.telegram.telegrambots.ApiContext; -import org.telegram.telegrambots.api.methods.updates.SetWebhook; +import org.telegram.telegrambots.api.methods.updates.DeleteWebhook; +import org.telegram.telegrambots.exceptions.TelegramApiException; import org.telegram.telegrambots.exceptions.TelegramApiRequestException; -import org.telegram.telegrambots.facilities.TelegramHttpClientBuilder; import org.telegram.telegrambots.generics.LongPollingBot; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - /** * @author Ruben Bermudez * @version 1.0 @@ -37,23 +23,13 @@ public abstract class TelegramLongPollingBot extends DefaultAbsSender implements @Override public void clearWebhook() throws TelegramApiRequestException { - try (CloseableHttpClient httpclient = TelegramHttpClientBuilder.build(getOptions())) { - String url = getOptions().getBaseUrl() + getBotToken() + "/" + SetWebhook.PATH; - HttpGet httpGet = new HttpGet(url); - httpGet.setConfig(getOptions().getRequestConfig()); - try (CloseableHttpResponse response = httpclient.execute(httpGet)) { - HttpEntity ht = response.getEntity(); - BufferedHttpEntity buf = new BufferedHttpEntity(ht); - String responseContent = EntityUtils.toString(buf, StandardCharsets.UTF_8); - JSONObject jsonObject = new JSONObject(responseContent); - if (!jsonObject.getBoolean(ApiConstants.RESPONSE_FIELD_OK)) { - throw new TelegramApiRequestException("Error removing old webhook", jsonObject); - } + try { + boolean result = execute(new DeleteWebhook()); + if (!result) { + throw new TelegramApiRequestException("Error removing old webhook"); } - } catch (JSONException e) { - throw new TelegramApiRequestException("Error deserializing setWebhook method response", e); - } catch (IOException e) { - throw new TelegramApiRequestException("Error executing setWebook method", e); + } catch (TelegramApiException e) { + throw new TelegramApiRequestException("Error removing old webhook", e); } }