From 85e3d74f47ba00ee02727f7612a66e41b16b6506 Mon Sep 17 00:00:00 2001 From: tolwi Date: Tue, 19 Apr 2016 13:14:54 +0300 Subject: [PATCH 1/2] fix_inline_response --- pom.xml | 2 +- .../inlinequery/result/InlineQueryResultArticle.java | 5 ++--- .../objects/inlinequery/result/InlineQueryResultAudio.java | 5 ++--- .../inlinequery/result/InlineQueryResultContact.java | 5 ++--- .../inlinequery/result/InlineQueryResultDocument.java | 5 ++--- .../objects/inlinequery/result/InlineQueryResultGif.java | 5 ++--- .../inlinequery/result/InlineQueryResultLocation.java | 5 ++--- .../inlinequery/result/InlineQueryResultMpeg4Gif.java | 7 +++---- .../objects/inlinequery/result/InlineQueryResultPhoto.java | 5 ++--- .../objects/inlinequery/result/InlineQueryResultVenue.java | 5 ++--- .../objects/inlinequery/result/InlineQueryResultVideo.java | 5 ++--- .../objects/inlinequery/result/InlineQueryResultVoice.java | 5 ++--- 12 files changed, 24 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index 5aad8867..34af5279 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ jar org.telegram telegrambots - 2.1 + 2.1.1-SNAPSHOT Telegram Bots Easy to use library to create Telegram Bots diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java index bb08b6ec..65ff5849 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -154,9 +153,9 @@ public class InlineQueryResultArticle implements InlineQueryResult { jsonObject.put(TYPE_FIELD, this.type); jsonObject.put(ID_FIELD, this.id); jsonObject.put(TITLE_FIELD, this.title); - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (url != null) { jsonObject.put(URL_FIELD, this.url); diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java index 6cb5fc91..4ac6d0a8 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -132,10 +131,10 @@ public class InlineQueryResultAudio implements InlineQueryResult { jsonObject.put(AUDIO_DURATION_FIELD, audioDuration); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } return jsonObject; diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java index 78ee36e3..63e36f62 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -150,10 +149,10 @@ public class InlineQueryResultContact implements InlineQueryResult { jsonObject.put(LAST_NAME_FIELD, lastName); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } if (thumbUrl != null) { jsonObject.put(THUMBURL_FIELD, this.thumbUrl); diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java index 74f1a6cf..1634265f 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -179,10 +178,10 @@ public class InlineQueryResultDocument implements InlineQueryResult { jsonObject.put(CAPTION_FIELD, caption); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } if (thumbUrl != null) { jsonObject.put(THUMBURL_FIELD, this.thumbUrl); diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java index 217d0c22..cd09d6e7 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -159,10 +158,10 @@ public class InlineQueryResultGif implements InlineQueryResult { jsonObject.put(CAPTION_FIELD, this.caption); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } return jsonObject; } diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java index bc5fbc86..7f4ddd93 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -148,10 +147,10 @@ public class InlineQueryResultLocation implements InlineQueryResult { jsonObject.put(TITLE_FIELD, title); jsonObject.put(LONGITUDE_FIELD, longitude); if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } if (thumbUrl != null) { jsonObject.put(THUMBURL_FIELD, this.thumbUrl); diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java index f9486568..ae5e2f03 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -141,7 +140,7 @@ public class InlineQueryResultMpeg4Gif implements InlineQueryResult { public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); - jsonObject.put(TYPE_FIELD, this.type); + jsonObject.put(TYPE_FIELD, type); jsonObject.put(ID_FIELD, this.id); jsonObject.put(MPEG4URL_FIELD, this.mpeg4Url); if (mpeg4Width != null) { @@ -160,10 +159,10 @@ public class InlineQueryResultMpeg4Gif implements InlineQueryResult { jsonObject.put(CAPTION_FIELD, this.caption); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } return jsonObject; diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java index 4ce4af90..6b9ef17c 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -190,10 +189,10 @@ public class InlineQueryResultPhoto implements InlineQueryResult { jsonObject.put(CAPTION_FIELD, this.caption); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } return jsonObject; diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java index b99feb7d..ed087c11 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -175,10 +174,10 @@ public class InlineQueryResultVenue implements InlineQueryResult { jsonObject.put(FOURSQUARE_ID_FIELD, foursquareId); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } if (thumbUrl != null) { jsonObject.put(THUMBURL_FIELD, this.thumbUrl); diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java index 3f6a3022..5d6b0b80 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -205,10 +204,10 @@ public class InlineQueryResultVideo implements InlineQueryResult { jsonObject.put(CAPTION_FIELD, caption); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } return jsonObject; diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java index 31631028..d90f3acb 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - import org.json.JSONObject; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; @@ -116,10 +115,10 @@ public class InlineQueryResultVoice implements InlineQueryResult { jsonObject.put(VOICE_DURATION_FIELD, voiceDuration); } if (replyMarkup != null) { - jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); + jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson()); } if (inputMessageContent != null) { - jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); + jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson()); } return jsonObject; } From aeed4ef639eb9e2dba76270cec59057192a370e4 Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Wed, 20 Apr 2016 19:48:02 +0200 Subject: [PATCH 2/2] Merge #39 --- README.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 81f669e4..6b419723 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ I recommend using getUpdates methods. ## Usage -Just import add the library to your project using [Maven, Gradly, ...](https://jitpack.io/#rubenlagus/TelegramBots/v2.1) or download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v2.1) +Just import add the library to your project using [Maven, Gradly, ...](https://jitpack.io/#rubenlagus/TelegramBots/v2.2) or download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v2.2) In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`. diff --git a/pom.xml b/pom.xml index 34af5279..a230c3c2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ jar org.telegram telegrambots - 2.1.1-SNAPSHOT + 2.2 Telegram Bots Easy to use library to create Telegram Bots