Merge branch 'flicus-master' into dev

This commit is contained in:
Rubenlagus 2016-04-02 18:17:38 +02:00
commit 9f77b71742
49 changed files with 494 additions and 21 deletions

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.httpcomponents:httpclient:4.5.1">
<library name="Maven: org.apache.httpcomponents:httpclient:4.5.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.1/httpclient-4.5.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.1/httpclient-4.5.1-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.1/httpclient-4.5.1-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.httpcomponents:httpcore:4.4.3">
<library name="Maven: org.apache.httpcomponents:httpcore:4.4.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.3/httpcore-4.4.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.3/httpcore-4.4.3-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.3/httpcore-4.4.3-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.httpcomponents:httpmime:4.5.1">
<library name="Maven: org.apache.httpcomponents:httpmime:4.5.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.1/httpmime-4.5.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.1/httpmime-4.5.1-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.1/httpmime-4.5.1-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -48,10 +48,10 @@
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
<orderEntry type="library" name="Maven: com.sun.jersey:jersey-servlet:1.19" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20151123" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
</component>
</module>

View File

@ -6,7 +6,7 @@
<packaging>jar</packaging>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>1.0</version>
<version>1.1</version>
<name>Telegram Bots</name>
<description>Easy to use library to create Telegram Bots</description>
@ -22,7 +22,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jersey.version>2.22.1</jersey.version>
<httpcompontents.version>4.5.1</httpcompontents.version>
<httpcompontents.version>4.5.2</httpcompontents.version>
</properties>
<dependencyManagement>

View File

@ -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;

View File

@ -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;
}

View File

@ -135,4 +135,15 @@ public class AnswerInlineQuery extends BotApiMethod<Boolean> {
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 + '\'' +
'}';
}
}

View File

@ -116,4 +116,13 @@ public class ForwardMessage extends BotApiMethod<Message> {
}
return null;
}
@Override
public String toString() {
return "ForwardMessage{" +
"chatId='" + chatId + '\'' +
", fromChatId=" + fromChatId +
", messageId=" + messageId +
'}';
}
}

View File

@ -71,4 +71,11 @@ public class GetFile extends BotApiMethod<File> {
}
return null;
}
@Override
public String toString() {
return "GetFile{" +
"fileId='" + fileId + '\'' +
'}';
}
}

View File

@ -47,4 +47,6 @@ public class GetMe extends BotApiMethod<User> {
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
}

View File

@ -78,4 +78,13 @@ public class GetUpdates implements IToJson {
}
return jsonObject;
}
@Override
public String toString() {
return "GetUpdates{" +
"offset=" + offset +
", limit=" + limit +
", timeout=" + timeout +
'}';
}
}

View File

@ -99,4 +99,13 @@ public class GetUserProfilePhotos extends BotApiMethod<UserProfilePhotos> {
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 +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -83,4 +83,12 @@ public class SendChatAction extends BotApiMethod<Boolean>{
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
serialize(gen, serializers);
}
@Override
public String toString() {
return "SendChatAction{" +
"chatId='" + chatId + '\'' +
", action='" + action + '\'' +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -147,4 +147,15 @@ public class SendLocation extends BotApiMethod<Message> {
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 +
'}';
}
}

View File

@ -180,4 +180,16 @@ public class SendMessage extends BotApiMethod<Message> {
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 +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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;
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 + '\'' +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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 +
'}';
}
}

View File

@ -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());

View File

@ -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);