Merge pull request #40 from rubenlagus/dev

Dev
This commit is contained in:
Ruben Bermudez 2016-04-20 19:48:46 +02:00
commit f2e569830d
13 changed files with 25 additions and 36 deletions

View File

@ -13,7 +13,7 @@ I recommend using getUpdates methods.
## Usage ## 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`. In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

View File

@ -6,7 +6,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<groupId>org.telegram</groupId> <groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId> <artifactId>telegrambots</artifactId>
<version>2.1</version> <version>2.2</version>
<name>Telegram Bots</name> <name>Telegram Bots</name>
<description>Easy to use library to create Telegram Bots</description> <description>Easy to use library to create Telegram Bots</description>

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; 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(TYPE_FIELD, this.type);
jsonObject.put(ID_FIELD, this.id); jsonObject.put(ID_FIELD, this.id);
jsonObject.put(TITLE_FIELD, this.title); jsonObject.put(TITLE_FIELD, this.title);
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (url != null) { if (url != null) {
jsonObject.put(URL_FIELD, this.url); jsonObject.put(URL_FIELD, this.url);

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -132,10 +131,10 @@ public class InlineQueryResultAudio implements InlineQueryResult {
jsonObject.put(AUDIO_DURATION_FIELD, audioDuration); jsonObject.put(AUDIO_DURATION_FIELD, audioDuration);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
return jsonObject; return jsonObject;

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -150,10 +149,10 @@ public class InlineQueryResultContact implements InlineQueryResult {
jsonObject.put(LAST_NAME_FIELD, lastName); jsonObject.put(LAST_NAME_FIELD, lastName);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
if (thumbUrl != null) { if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl); jsonObject.put(THUMBURL_FIELD, this.thumbUrl);

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -179,10 +178,10 @@ public class InlineQueryResultDocument implements InlineQueryResult {
jsonObject.put(CAPTION_FIELD, caption); jsonObject.put(CAPTION_FIELD, caption);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
if (thumbUrl != null) { if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl); jsonObject.put(THUMBURL_FIELD, this.thumbUrl);

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -159,10 +158,10 @@ public class InlineQueryResultGif implements InlineQueryResult {
jsonObject.put(CAPTION_FIELD, this.caption); jsonObject.put(CAPTION_FIELD, this.caption);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
return jsonObject; return jsonObject;
} }

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -148,10 +147,10 @@ public class InlineQueryResultLocation implements InlineQueryResult {
jsonObject.put(TITLE_FIELD, title); jsonObject.put(TITLE_FIELD, title);
jsonObject.put(LONGITUDE_FIELD, longitude); jsonObject.put(LONGITUDE_FIELD, longitude);
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
if (thumbUrl != null) { if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl); jsonObject.put(THUMBURL_FIELD, this.thumbUrl);

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -141,7 +140,7 @@ public class InlineQueryResultMpeg4Gif implements InlineQueryResult {
public JSONObject toJson() { public JSONObject toJson() {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put(TYPE_FIELD, this.type); jsonObject.put(TYPE_FIELD, type);
jsonObject.put(ID_FIELD, this.id); jsonObject.put(ID_FIELD, this.id);
jsonObject.put(MPEG4URL_FIELD, this.mpeg4Url); jsonObject.put(MPEG4URL_FIELD, this.mpeg4Url);
if (mpeg4Width != null) { if (mpeg4Width != null) {
@ -160,10 +159,10 @@ public class InlineQueryResultMpeg4Gif implements InlineQueryResult {
jsonObject.put(CAPTION_FIELD, this.caption); jsonObject.put(CAPTION_FIELD, this.caption);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
return jsonObject; return jsonObject;

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -190,10 +189,10 @@ public class InlineQueryResultPhoto implements InlineQueryResult {
jsonObject.put(CAPTION_FIELD, this.caption); jsonObject.put(CAPTION_FIELD, this.caption);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
return jsonObject; return jsonObject;

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -175,10 +174,10 @@ public class InlineQueryResultVenue implements InlineQueryResult {
jsonObject.put(FOURSQUARE_ID_FIELD, foursquareId); jsonObject.put(FOURSQUARE_ID_FIELD, foursquareId);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
if (thumbUrl != null) { if (thumbUrl != null) {
jsonObject.put(THUMBURL_FIELD, this.thumbUrl); jsonObject.put(THUMBURL_FIELD, this.thumbUrl);

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -205,10 +204,10 @@ public class InlineQueryResultVideo implements InlineQueryResult {
jsonObject.put(CAPTION_FIELD, caption); jsonObject.put(CAPTION_FIELD, caption);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
return jsonObject; return jsonObject;

View File

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject; import org.json.JSONObject;
import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -116,10 +115,10 @@ public class InlineQueryResultVoice implements InlineQueryResult {
jsonObject.put(VOICE_DURATION_FIELD, voiceDuration); jsonObject.put(VOICE_DURATION_FIELD, voiceDuration);
} }
if (replyMarkup != null) { if (replyMarkup != null) {
jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup); jsonObject.put(REPLY_MARKUP_FIELD, replyMarkup.toJson());
} }
if (inputMessageContent != null) { if (inputMessageContent != null) {
jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent); jsonObject.put(INPUTMESSAGECONTENT_FIELD, inputMessageContent.toJson());
} }
return jsonObject; return jsonObject;
} }