commit
f2e569830d
@ -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`.
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
<packaging>jar</packaging>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>2.2</version>
|
||||
|
||||
<name>Telegram Bots</name>
|
||||
<description>Easy to use library to create Telegram Bots</description>
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user