diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_1.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_2.xml
similarity index 70%
rename from .idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_1.xml
rename to .idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_2.xml
index 958a9faf..fdb7eada 100644
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_1.xml
+++ b/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_2.xml
@@ -1,13 +1,13 @@
-
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_3.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_4.xml
similarity index 61%
rename from .idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_3.xml
rename to .idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_4.xml
index a9f8d494..3a5aa19c 100644
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_3.xml
+++ b/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_4.xml
@@ -1,13 +1,13 @@
-
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_1.xml b/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_2.xml
similarity index 61%
rename from .idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_1.xml
rename to .idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_2.xml
index 793e63d6..4b2025af 100644
--- a/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_1.xml
+++ b/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5_2.xml
@@ -1,13 +1,13 @@
-
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/TelegramBots.iml b/TelegramBots.iml
index efbc891b..f0d376fb 100644
--- a/TelegramBots.iml
+++ b/TelegramBots.iml
@@ -48,10 +48,10 @@
-
-
+
+
-
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index cd8949d7..66d69447 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
jar
org.telegram
telegrambots
- 1.0
+ 1.1
Telegram Bots
Easy to use library to create Telegram Bots
@@ -22,7 +22,7 @@
UTF-8
UTF-8
2.22.1
- 4.5.1
+ 4.5.2
diff --git a/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java b/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java
index e0aeef53..f9569ec4 100644
--- a/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java
+++ b/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java
@@ -1,6 +1,8 @@
package org.telegram.telegrambots;
import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
diff --git a/src/main/java/org/telegram/telegrambots/api/Constants.java b/src/main/java/org/telegram/telegrambots/api/Constants.java
index aa406e34..8c05d9de 100644
--- a/src/main/java/org/telegram/telegrambots/api/Constants.java
+++ b/src/main/java/org/telegram/telegrambots/api/Constants.java
@@ -8,4 +8,5 @@ package org.telegram.telegrambots.api;
*/
public class Constants {
public static final String BASEURL = "https://api.telegram.org/bot";
+ public static final int SOCKET_TIMEOUT = 30 * 1000;
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java b/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java
index 37ec2757..8d37d3f5 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java
@@ -135,4 +135,15 @@ public class AnswerInlineQuery extends BotApiMethod {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "AnswerInlineQuery{" +
+ "inlineQueryId='" + inlineQueryId + '\'' +
+ ", results=" + results +
+ ", cacheTime=" + cacheTime +
+ ", isPersonal=" + isPersonal +
+ ", nextOffset='" + nextOffset + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java b/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java
index 24883d44..45018183 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java
@@ -116,4 +116,13 @@ public class ForwardMessage extends BotApiMethod {
}
return null;
}
+
+ @Override
+ public String toString() {
+ return "ForwardMessage{" +
+ "chatId='" + chatId + '\'' +
+ ", fromChatId=" + fromChatId +
+ ", messageId=" + messageId +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java b/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java
index dc73ed99..3c2df8ef 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java
@@ -71,4 +71,11 @@ public class GetFile extends BotApiMethod {
}
return null;
}
+
+ @Override
+ public String toString() {
+ return "GetFile{" +
+ "fileId='" + fileId + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/GetMe.java b/src/main/java/org/telegram/telegrambots/api/methods/GetMe.java
index 46ec62bd..a9f025b1 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/GetMe.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/GetMe.java
@@ -47,4 +47,6 @@ public class GetMe extends BotApiMethod {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/GetUpdates.java b/src/main/java/org/telegram/telegrambots/api/methods/GetUpdates.java
index 8b40a8f7..6195ab66 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/GetUpdates.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/GetUpdates.java
@@ -78,4 +78,13 @@ public class GetUpdates implements IToJson {
}
return jsonObject;
}
+
+ @Override
+ public String toString() {
+ return "GetUpdates{" +
+ "offset=" + offset +
+ ", limit=" + limit +
+ ", timeout=" + timeout +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java b/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java
index d29828ee..45490c74 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java
@@ -99,4 +99,13 @@ public class GetUserProfilePhotos extends BotApiMethod {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "GetUserProfilePhotos{" +
+ "userId=" + userId +
+ ", offset=" + offset +
+ ", limit=" + limit +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendAudio.java b/src/main/java/org/telegram/telegrambots/api/methods/SendAudio.java
index 203cc628..4e90fb8b 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendAudio.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendAudio.java
@@ -140,4 +140,18 @@ public class SendAudio {
public String getAudioName() {
return audioName;
}
+
+ @Override
+ public String toString() {
+ return "SendAudio{" +
+ "chatId='" + chatId + '\'' +
+ ", audio='" + audio + '\'' +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ ", performer='" + performer + '\'' +
+ ", title='" + title + '\'' +
+ ", isNewAudio=" + isNewAudio +
+ ", audioName='" + audioName + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendChatAction.java b/src/main/java/org/telegram/telegrambots/api/methods/SendChatAction.java
index 98f63500..ac168d81 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendChatAction.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendChatAction.java
@@ -83,4 +83,12 @@ public class SendChatAction extends BotApiMethod{
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "SendChatAction{" +
+ "chatId='" + chatId + '\'' +
+ ", action='" + action + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendDocument.java b/src/main/java/org/telegram/telegrambots/api/methods/SendDocument.java
index d1ae50a5..83bb9b51 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendDocument.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendDocument.java
@@ -103,4 +103,16 @@ public class SendDocument {
public void setReplayMarkup(ReplyKeyboard replayMarkup) {
this.replayMarkup = replayMarkup;
}
+
+ @Override
+ public String toString() {
+ return "SendDocument{" +
+ "chatId='" + chatId + '\'' +
+ ", document='" + document + '\'' +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ ", isNewDocument=" + isNewDocument +
+ ", documentName='" + documentName + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendLocation.java b/src/main/java/org/telegram/telegrambots/api/methods/SendLocation.java
index 9bf26f8d..badbe8d7 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendLocation.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendLocation.java
@@ -147,4 +147,15 @@ public class SendLocation extends BotApiMethod {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "SendLocation{" +
+ "chatId='" + chatId + '\'' +
+ ", latitude=" + latitude +
+ ", longitude=" + longitude +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendMessage.java b/src/main/java/org/telegram/telegrambots/api/methods/SendMessage.java
index acba1990..ccb11b4f 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendMessage.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendMessage.java
@@ -180,4 +180,16 @@ public class SendMessage extends BotApiMethod {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "SendMessage{" +
+ "chatId='" + chatId + '\'' +
+ ", text='" + text + '\'' +
+ ", parseMode='" + parseMode + '\'' +
+ ", disableWebPagePreview=" + disableWebPagePreview +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendPhoto.java b/src/main/java/org/telegram/telegrambots/api/methods/SendPhoto.java
index 6dfafbe8..0a369854 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendPhoto.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendPhoto.java
@@ -104,4 +104,17 @@ public class SendPhoto {
this.isNewPhoto = true;
this.photoName = photoName;
}
+
+ @Override
+ public String toString() {
+ return "SendPhoto{" +
+ "chatId='" + chatId + '\'' +
+ ", photo='" + photo + '\'' +
+ ", caption='" + caption + '\'' +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ ", isNewPhoto=" + isNewPhoto +
+ ", photoName='" + photoName + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendSticker.java b/src/main/java/org/telegram/telegrambots/api/methods/SendSticker.java
index 351561a9..f1d4c9dd 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendSticker.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendSticker.java
@@ -93,4 +93,16 @@ public class SendSticker {
public String getStickerName() {
return stickerName;
}
+
+ @Override
+ public String toString() {
+ return "SendSticker{" +
+ "chatId='" + chatId + '\'' +
+ ", sticker='" + sticker + '\'' +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ ", isNewSticker=" + isNewSticker +
+ ", stickerName='" + stickerName + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendVideo.java b/src/main/java/org/telegram/telegrambots/api/methods/SendVideo.java
index f6fdf630..1885c93a 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendVideo.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendVideo.java
@@ -135,4 +135,18 @@ public class SendVideo {
this.isNewVideo = true;
this.videoName = videoName;
}
+
+ @Override
+ public String toString() {
+ return "SendVideo{" +
+ "chatId='" + chatId + '\'' +
+ ", video='" + video + '\'' +
+ ", duration=" + duration +
+ ", caption='" + caption + '\'' +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ ", isNewVideo=" + isNewVideo +
+ ", videoName='" + videoName + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SendVoice.java b/src/main/java/org/telegram/telegrambots/api/methods/SendVoice.java
index 2e26fa29..6bf5e52a 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SendVoice.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SendVoice.java
@@ -40,6 +40,17 @@ public class SendVoice {
super();
}
+ @Override
+ public String toString() {
+ return "SendVoice{" +
+ "chatId='" + chatId + '\'' +
+ ", audio='" + audio + '\'' +
+ ", replayToMessageId=" + replayToMessageId +
+ ", replayMarkup=" + replayMarkup +
+ ", duration=" + duration +
+ '}';
+ }
+
public Boolean getDisableNotification() {
return disableNotification;
}
diff --git a/src/main/java/org/telegram/telegrambots/api/methods/SetWebhook.java b/src/main/java/org/telegram/telegrambots/api/methods/SetWebhook.java
index 5cba2975..46f05549 100644
--- a/src/main/java/org/telegram/telegrambots/api/methods/SetWebhook.java
+++ b/src/main/java/org/telegram/telegrambots/api/methods/SetWebhook.java
@@ -36,4 +36,12 @@ public class SetWebhook {
public void setCertificateFile(String certificateFile) {
this.certificateFile = certificateFile;
}
+
+ @Override
+ public String toString() {
+ return "SetWebhook{" +
+ "url='" + url + '\'' +
+ ", certificateFile='" + certificateFile + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Audio.java b/src/main/java/org/telegram/telegrambots/api/objects/Audio.java
index a21adaed..bdafd217 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Audio.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Audio.java
@@ -131,4 +131,16 @@ public class Audio implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Audio{" +
+ "fileId='" + fileId + '\'' +
+ ", duration=" + duration +
+ ", mimeType='" + mimeType + '\'' +
+ ", fileSize=" + fileSize +
+ ", title='" + title + '\'' +
+ ", performer='" + performer + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Chat.java b/src/main/java/org/telegram/telegrambots/api/objects/Chat.java
index dbf68921..6776b0b2 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Chat.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Chat.java
@@ -126,4 +126,16 @@ public class Chat implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Chat{" +
+ "id=" + id +
+ ", type='" + type + '\'' +
+ ", title='" + title + '\'' +
+ ", firstName='" + firstName + '\'' +
+ ", lastName='" + lastName + '\'' +
+ ", userName='" + userName + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/ChosenInlineQuery.java b/src/main/java/org/telegram/telegrambots/api/objects/ChosenInlineQuery.java
index aecca51a..8ea998e9 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/ChosenInlineQuery.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/ChosenInlineQuery.java
@@ -63,4 +63,13 @@ public class ChosenInlineQuery implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "ChosenInlineQuery{" +
+ "resultId='" + resultId + '\'' +
+ ", from=" + from +
+ ", query='" + query + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Contact.java b/src/main/java/org/telegram/telegrambots/api/objects/Contact.java
index 7fc381a6..1636be34 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Contact.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Contact.java
@@ -65,4 +65,14 @@ public class Contact implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Contact{" +
+ "phoneNumber='" + phoneNumber + '\'' +
+ ", firstName='" + firstName + '\'' +
+ ", lastName='" + lastName + '\'' +
+ ", userID=" + userID +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Document.java b/src/main/java/org/telegram/telegrambots/api/objects/Document.java
index b562fd4d..78a21b33 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Document.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Document.java
@@ -116,4 +116,15 @@ public class Document implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Document{" +
+ "fileId='" + fileId + '\'' +
+ ", thumb=" + thumb +
+ ", fileName='" + fileName + '\'' +
+ ", mimeType='" + mimeType + '\'' +
+ ", fileSize=" + fileSize +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/File.java b/src/main/java/org/telegram/telegrambots/api/objects/File.java
index 97f9037f..5440b0ce 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/File.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/File.java
@@ -83,4 +83,13 @@ public class File implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "File{" +
+ "fileId='" + fileId + '\'' +
+ ", fileSize=" + fileSize +
+ ", filePath='" + filePath + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/ForceReplyKeyboard.java b/src/main/java/org/telegram/telegrambots/api/objects/ForceReplyKeyboard.java
index ced0d9c5..18149d9a 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/ForceReplyKeyboard.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/ForceReplyKeyboard.java
@@ -91,4 +91,12 @@ public class ForceReplyKeyboard implements ReplyKeyboard {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "ForceReplyKeyboard{" +
+ "forceReply=" + forceReply +
+ ", selective=" + selective +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/InlineQuery.java b/src/main/java/org/telegram/telegrambots/api/objects/InlineQuery.java
index b0d44a69..afd5a693 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/InlineQuery.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/InlineQuery.java
@@ -73,4 +73,15 @@ public class InlineQuery implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "InlineQuery{" +
+ "id='" + id + '\'' +
+ ", from=" + from +
+ ", query='" + query + '\'' +
+ ", offset='" + offset + '\'' +
+ '}';
+ }
}
+
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultArticle.java b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultArticle.java
index 7d21bb50..d8305831 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultArticle.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultArticle.java
@@ -239,4 +239,22 @@ public class InlineQueryResultArticle implements InlineQueryResult {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "InlineQueryResultArticle{" +
+ "type='" + type + '\'' +
+ ", id='" + id + '\'' +
+ ", title='" + title + '\'' +
+ ", messageText='" + messageText + '\'' +
+ ", parseMode='" + parseMode + '\'' +
+ ", disableWebPagePreview=" + disableWebPagePreview +
+ ", url='" + url + '\'' +
+ ", hideUrl=" + hideUrl +
+ ", description='" + description + '\'' +
+ ", thumbUrl='" + thumbUrl + '\'' +
+ ", thumbWidth=" + thumbWidth +
+ ", thumbHeight=" + thumbHeight +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultGif.java b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultGif.java
index 8d887f7a..b6598322 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultGif.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultGif.java
@@ -223,4 +223,21 @@ public class InlineQueryResultGif implements InlineQueryResult {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "InlineQueryResultGif{" +
+ "type='" + type + '\'' +
+ ", id='" + id + '\'' +
+ ", gifUrl='" + gifUrl + '\'' +
+ ", gifWidth=" + gifWidth +
+ ", gifHeight=" + gifHeight +
+ ", thumbUrl='" + thumbUrl + '\'' +
+ ", title='" + title + '\'' +
+ ", caption='" + caption + '\'' +
+ ", messageText='" + messageText + '\'' +
+ ", parseMode='" + parseMode + '\'' +
+ ", disableWebPagePreview=" + disableWebPagePreview +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultMpeg4Gif.java b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultMpeg4Gif.java
index 4e71c2e5..5c51354c 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultMpeg4Gif.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultMpeg4Gif.java
@@ -224,4 +224,21 @@ public class InlineQueryResultMpeg4Gif implements InlineQueryResult {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "InlineQueryResultMpeg4Gif{" +
+ "type='" + type + '\'' +
+ ", id='" + id + '\'' +
+ ", mpeg4Url='" + mpeg4Url + '\'' +
+ ", mpeg4Width=" + mpeg4Width +
+ ", mpeg4Height=" + mpeg4Height +
+ ", thumbUrl='" + thumbUrl + '\'' +
+ ", title='" + title + '\'' +
+ ", caption='" + caption + '\'' +
+ ", messageText='" + messageText + '\'' +
+ ", parseMode='" + parseMode + '\'' +
+ ", disableWebPagePreview=" + disableWebPagePreview +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultPhoto.java b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultPhoto.java
index 861208d4..727d47df 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultPhoto.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultPhoto.java
@@ -259,4 +259,23 @@ public class InlineQueryResultPhoto implements InlineQueryResult {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "InlineQueryResultPhoto{" +
+ "type='" + type + '\'' +
+ ", id='" + id + '\'' +
+ ", photoUrl='" + photoUrl + '\'' +
+ ", mimeType='" + mimeType + '\'' +
+ ", photoWidth=" + photoWidth +
+ ", photoHeight=" + photoHeight +
+ ", thumbUrl='" + thumbUrl + '\'' +
+ ", title='" + title + '\'' +
+ ", description='" + description + '\'' +
+ ", caption='" + caption + '\'' +
+ ", messageText='" + messageText + '\'' +
+ ", parseMode='" + parseMode + '\'' +
+ ", disableWebPagePreview=" + disableWebPagePreview +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultVideo.java b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultVideo.java
index a62bf6de..b8ca5384 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultVideo.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/InlineQueryResultVideo.java
@@ -255,4 +255,23 @@ public class InlineQueryResultVideo implements InlineQueryResult {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "InlineQueryResultVideo{" +
+ "type='" + type + '\'' +
+ ", id='" + id + '\'' +
+ ", mimeType='" + mimeType + '\'' +
+ ", videoUrl='" + videoUrl + '\'' +
+ ", videoWidth=" + videoWidth +
+ ", videoHeight=" + videoHeight +
+ ", videoDuration=" + videoDuration +
+ ", thumbUrl='" + thumbUrl + '\'' +
+ ", title='" + title + '\'' +
+ ", description='" + description + '\'' +
+ ", messageText='" + messageText + '\'' +
+ ", parseMode='" + parseMode + '\'' +
+ ", disableWebPagePreview=" + disableWebPagePreview +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Location.java b/src/main/java/org/telegram/telegrambots/api/objects/Location.java
index 14d1b3b1..c59f963d 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Location.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Location.java
@@ -63,4 +63,12 @@ public class Location implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Location{" +
+ "longitude=" + longitude +
+ ", latitude=" + latitude +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Message.java b/src/main/java/org/telegram/telegrambots/api/objects/Message.java
index 8fa6f5d8..443bcabf 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Message.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Message.java
@@ -525,4 +525,36 @@ public class Message implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Message{" +
+ "messageId=" + messageId +
+ ", from=" + from +
+ ", date=" + date +
+ ", chat=" + chat +
+ ", forwardFrom=" + forwardFrom +
+ ", forwardDate=" + forwardDate +
+ ", text='" + text + '\'' +
+ ", audio=" + audio +
+ ", document=" + document +
+ ", photo=" + photo +
+ ", sticker=" + sticker +
+ ", video=" + video +
+ ", contact=" + contact +
+ ", location=" + location +
+ ", newChatParticipant=" + newChatParticipant +
+ ", leftChatParticipant=" + leftChatParticipant +
+ ", newChatTitle='" + newChatTitle + '\'' +
+ ", newChatPhoto=" + newChatPhoto +
+ ", deleteChatPhoto=" + deleteChatPhoto +
+ ", groupchatCreated=" + groupchatCreated +
+ ", replyToMessage=" + replyToMessage +
+ ", voice=" + voice +
+ ", superGroupCreated=" + superGroupCreated +
+ ", channelChatCreated=" + channelChatCreated +
+ ", migrateToChatId=" + migrateToChatId +
+ ", migrateFromChatId=" + migrateFromChatId +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java b/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java
index c60a3b77..5939ef85 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java
@@ -111,4 +111,14 @@ public class PhotoSize implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "PhotoSize{" +
+ "fileId='" + fileId + '\'' +
+ ", width=" + width +
+ ", height=" + height +
+ ", fileSize=" + fileSize +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardHide.java b/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardHide.java
index dd7b81c0..9b370618 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardHide.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardHide.java
@@ -85,4 +85,12 @@ public class ReplyKeyboardHide implements ReplyKeyboard {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "ReplyKeyboardHide{" +
+ "hideKeyboard=" + hideKeyboard +
+ ", selective=" + selective +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardMarkup.java b/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardMarkup.java
index 4277d159..e268566e 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardMarkup.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/ReplyKeyboardMarkup.java
@@ -153,4 +153,14 @@ public class ReplyKeyboardMarkup implements ReplyKeyboard {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "ReplyKeyboardMarkup{" +
+ "keyboard=" + keyboard +
+ ", resizeKeyboard=" + resizeKeyboard +
+ ", oneTimeKeyboad=" + oneTimeKeyboad +
+ ", selective=" + selective +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Sticker.java b/src/main/java/org/telegram/telegrambots/api/objects/Sticker.java
index 0505fc95..2a76a5de 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Sticker.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Sticker.java
@@ -70,4 +70,15 @@ public class Sticker implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Sticker{" +
+ "fileId='" + fileId + '\'' +
+ ", width=" + width +
+ ", height=" + height +
+ ", thumb=" + thumb +
+ ", fileSize=" + fileSize +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Update.java b/src/main/java/org/telegram/telegrambots/api/objects/Update.java
index 3c111d14..a3992945 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Update.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Update.java
@@ -101,4 +101,14 @@ public class Update implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Update{" +
+ "updateId=" + updateId +
+ ", message=" + message +
+ ", inlineQuery=" + inlineQuery +
+ ", chosenInlineQuery=" + chosenInlineQuery +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/User.java b/src/main/java/org/telegram/telegrambots/api/objects/User.java
index 6a5a3918..c7920f4d 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/User.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/User.java
@@ -81,4 +81,14 @@ public class User implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "User{" +
+ "id=" + id +
+ ", firstName='" + firstName + '\'' +
+ ", lastName='" + lastName + '\'' +
+ ", userName='" + userName + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java b/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java
index 541900aa..5d680abb 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java
@@ -87,4 +87,12 @@ public class UserProfilePhotos implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "UserProfilePhotos{" +
+ "totalCount=" + totalCount +
+ ", photos=" + photos +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Video.java b/src/main/java/org/telegram/telegrambots/api/objects/Video.java
index 34816083..0a741909 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Video.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Video.java
@@ -139,4 +139,17 @@ public class Video implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Video{" +
+ "fileId='" + fileId + '\'' +
+ ", width=" + width +
+ ", height=" + height +
+ ", duration=" + duration +
+ ", thumb=" + thumb +
+ ", mimeType='" + mimeType + '\'' +
+ ", fileSize=" + fileSize +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Voice.java b/src/main/java/org/telegram/telegrambots/api/objects/Voice.java
index bb5af2ef..4d695356 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/Voice.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/Voice.java
@@ -96,4 +96,14 @@ public class Voice implements IBotApiObject {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
+
+ @Override
+ public String toString() {
+ return "Voice{" +
+ "fileId='" + fileId + '\'' +
+ ", duration=" + duration +
+ ", mimeType='" + mimeType + '\'' +
+ ", fileSize=" + fileSize +
+ '}';
+ }
}
diff --git a/src/main/java/org/telegram/telegrambots/bots/AbsSender.java b/src/main/java/org/telegram/telegrambots/bots/AbsSender.java
index 5dcc82a4..216d0003 100644
--- a/src/main/java/org/telegram/telegrambots/bots/AbsSender.java
+++ b/src/main/java/org/telegram/telegrambots/bots/AbsSender.java
@@ -2,6 +2,7 @@ package org.telegram.telegrambots.bots;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -213,7 +214,6 @@ public abstract class AbsSender {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = getBaseUrl() + SendDocument.PATH;
HttpPost httppost = new HttpPost(url);
-
if (sendDocument.isNewDocument()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendDocument.CHATID_FIELD, sendDocument.getChatId());
@@ -273,7 +273,6 @@ public abstract class AbsSender {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = getBaseUrl() + SendPhoto.PATH;
HttpPost httppost = new HttpPost(url);
-
if (sendPhoto.isNewPhoto()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendPhoto.CHATID_FIELD, sendPhoto.getChatId());
@@ -333,7 +332,6 @@ public abstract class AbsSender {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = getBaseUrl() + SendVideo.PATH;
HttpPost httppost = new HttpPost(url);
-
if (sendVideo.isNewVideo()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendVideo.CHATID_FIELD, sendVideo.getChatId());
@@ -412,7 +410,6 @@ public abstract class AbsSender {
CloseableHttpClient httpClient = HttpClients.createDefault();
String url = getBaseUrl() + SendSticker.PATH;
HttpPost httppost = new HttpPost(url);
-
if (sendSticker.isNewSticker()) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(SendSticker.CHATID_FIELD, sendSticker.getChatId());
diff --git a/src/main/java/org/telegram/telegrambots/updatesreceivers/UpdatesThread.java b/src/main/java/org/telegram/telegrambots/updatesreceivers/UpdatesThread.java
index 968a64ff..cbe9f650 100644
--- a/src/main/java/org/telegram/telegrambots/updatesreceivers/UpdatesThread.java
+++ b/src/main/java/org/telegram/telegrambots/updatesreceivers/UpdatesThread.java
@@ -2,6 +2,7 @@ package org.telegram.telegrambots.updatesreceivers;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.entity.BufferedHttpEntity;
@@ -57,9 +58,17 @@ public class UpdatesThread {
request.setOffset(lastReceivedUpdate + 1);
CloseableHttpClient httpclient = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).setConnectionTimeToLive(20, TimeUnit.SECONDS).build();
String url = Constants.BASEURL + token + "/" + GetUpdates.PATH;
+ //config
+ RequestConfig defaultRequestConfig = RequestConfig.custom().build();
+ RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig)
+ .setSocketTimeout(Constants.SOCKET_TIMEOUT)
+ .setConnectTimeout(Constants.SOCKET_TIMEOUT)
+ .setConnectionRequestTimeout(Constants.SOCKET_TIMEOUT).build();
+ //http client
HttpPost httpPost = new HttpPost(url);
try {
httpPost.addHeader("charset", "UTF-8");
+ httpPost.setConfig(requestConfig);
httpPost.setEntity(new StringEntity(request.toJson().toString(), ContentType.APPLICATION_JSON));
HttpResponse response;
response = httpclient.execute(httpPost);