diff --git a/README.md b/README.md
index df809a84..29baada6 100644
--- a/README.md
+++ b/README.md
@@ -27,16 +27,16 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambots
- 4.7
+ 4.8
```
```gradle
- compile "org.telegram:telegrambots:4.7"
+ compile "org.telegram:telegrambots:4.8"
```
- 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.7)
- 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.7)
+ 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.8)
+ 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.8)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
diff --git a/TelegramBots.wiki/Changelog.md b/TelegramBots.wiki/Changelog.md
index 1a666552..2e7fd9d2 100644
--- a/TelegramBots.wiki/Changelog.md
+++ b/TelegramBots.wiki/Changelog.md
@@ -1,3 +1,6 @@
+### 4.8 ###
+1. Update Api version [4.8](https://core.telegram.org/bots/api-changelog#april-24-2020)
+
### 4.7 ###
1. Update Api version [4.7](https://core.telegram.org/bots/api-changelog#march-30-2020)
diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md
index 9eba8666..58dbf7cc 100644
--- a/TelegramBots.wiki/Getting-Started.md
+++ b/TelegramBots.wiki/Getting-Started.md
@@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss
org.telegram
telegrambots
- 4.7
+ 4.8
```
* With **Gradle**:
```groovy
- compile group: 'org.telegram', name: 'telegrambots', version: '4.7'
+ compile group: 'org.telegram', name: 'telegrambots', version: '4.8'
```
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md
index 3e3407c6..3b6d492b 100644
--- a/TelegramBots.wiki/abilities/Simple-Example.md
+++ b/TelegramBots.wiki/abilities/Simple-Example.md
@@ -9,7 +9,7 @@ As with any Java project, you will need to set your dependencies.
org.telegram
telegrambots-abilities
- 4.7
+ 4.8
```
* **Gradle**
diff --git a/pom.xml b/pom.xml
index 593ae589..8ad6e84e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
pom
- 4.7
+ 4.8
telegrambots
diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md
index 018a1d6c..869c3b17 100644
--- a/telegrambots-abilities/README.md
+++ b/telegrambots-abilities/README.md
@@ -18,19 +18,19 @@ Usage
org.telegram
telegrambots-abilities
- 4.7
+ 4.8
```
**Gradle**
```gradle
- compile "org.telegram:telegrambots-abilities:4.7"
+ compile "org.telegram:telegrambots-abilities:4.8"
```
-**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.7)
+**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.8)
-**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.7)
+**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.8)
Motivation
----------
diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml
index de5452d8..c5481717 100644
--- a/telegrambots-abilities/pom.xml
+++ b/telegrambots-abilities/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.7
+ 4.8
telegrambots-abilities
@@ -84,7 +84,7 @@
org.telegram
telegrambots
- 4.7
+ 4.8
org.apache.commons
diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md
index c8ca3f29..200dada6 100644
--- a/telegrambots-chat-session-bot/README.md
+++ b/telegrambots-chat-session-bot/README.md
@@ -15,7 +15,7 @@ Usage
org.telegram
telegrambots-chat-session-bot
- 4.7
+ 4.8
```
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index d8ebd720..5d3f6274 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.7
+ 4.8
telegrambots-chat-session-bot
@@ -84,7 +84,7 @@
org.telegram
telegrambots
- 4.7
+ 4.8
diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md
index ec5e4e06..e1fdc519 100644
--- a/telegrambots-extensions/README.md
+++ b/telegrambots-extensions/README.md
@@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambotsextensions
- 4.7
+ 4.8
```
2. Using Gradle:
```gradle
- compile "org.telegram:telegrambotsextensions:4.7"
+ compile "org.telegram:telegrambotsextensions:4.8"
```
\ No newline at end of file
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index 495e12e6..6f20fabf 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.7
+ 4.8
telegrambotsextensions
@@ -75,7 +75,7 @@
org.telegram
telegrambots
- 4.7
+ 4.8
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index 889dbd23..c06aeda4 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.7
+ 4.8
telegrambots-meta
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java
index 73ccff35..8a6dd3a9 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java
@@ -39,6 +39,10 @@ public class SendPoll extends BotApiMethod {
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private static final String REPLYMARKUP_FIELD = "reply_markup";
+ private static final String OPENPERIOD_FIELD = "open_period";
+ private static final String CLOSEDATE_FIELD = "close_date";
+ private static final String EXPLANATION_FIELD = "explanation";
+ private static final String EXPLANATIONPARSEMODE_FIELD = "explanation_parse_mode";
/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername).
@@ -67,7 +71,14 @@ public class SendPoll extends BotApiMethod {
@JsonProperty(REPLYMARKUP_FIELD)
@JsonDeserialize()
private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
-
+ @JsonProperty(OPENPERIOD_FIELD)
+ private Integer openPeriod; ///< Optional. Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
+ @JsonProperty(CLOSEDATE_FIELD)
+ private Integer closeDate; ///< Optional. Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
+ @JsonProperty(EXPLANATION_FIELD)
+ private String explanation; ///< Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
+ @JsonProperty(EXPLANATIONPARSEMODE_FIELD)
+ private String explanationParseMode; ///< Optional. Mode for parsing entities in the explanation. See formatting options for more details.
public SendPoll() {
super();
@@ -196,6 +207,42 @@ public class SendPoll extends BotApiMethod {
return this;
}
+ public Integer getOpenPeriod() {
+ return openPeriod;
+ }
+
+ public SendPoll setOpenPeriod(Integer openPeriod) {
+ this.openPeriod = openPeriod;
+ return this;
+ }
+
+ public Integer getCloseDate() {
+ return closeDate;
+ }
+
+ public SendPoll setCloseDate(Integer closeDate) {
+ this.closeDate = closeDate;
+ return this;
+ }
+
+ public String getExplanation() {
+ return explanation;
+ }
+
+ public SendPoll setExplanation(String explanation) {
+ this.explanation = explanation;
+ return this;
+ }
+
+ public String getExplanationParseMode() {
+ return explanationParseMode;
+ }
+
+ public SendPoll setExplanationParseMode(String explanationParseMode) {
+ this.explanationParseMode = explanationParseMode;
+ return this;
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -228,6 +275,15 @@ public class SendPoll extends BotApiMethod {
if (options == null || options.size() < 2 || options.size() > 10) {
throw new TelegramApiValidationException("Options parameter must be between 2 and 10 item", this);
}
+ if (openPeriod != null && closeDate != null) {
+ throw new TelegramApiValidationException("Only one of Open Period and Close Date are allowed", this);
+ }
+ if (openPeriod != null && (openPeriod < 5 || openPeriod > 600)) {
+ throw new TelegramApiValidationException("Open period can only be between 5 and 600", this);
+ }
+ if (explanation != null && explanation.length() > 200) {
+ throw new TelegramApiValidationException("Explanation can only have up to 200 characters", this);
+ }
if (options.parallelStream().anyMatch(x -> x.isEmpty() || x.length() > 100)) {
throw new TelegramApiValidationException("Options parameter values must be between 1 and 100 chars length", this);
}
@@ -236,7 +292,6 @@ public class SendPoll extends BotApiMethod {
}
}
-
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -252,13 +307,17 @@ public class SendPoll extends BotApiMethod {
Objects.equals(isClosed, sendPoll.isClosed) &&
Objects.equals(disableNotification, sendPoll.disableNotification) &&
Objects.equals(replyToMessageId, sendPoll.replyToMessageId) &&
- Objects.equals(replyMarkup, sendPoll.replyMarkup);
+ Objects.equals(replyMarkup, sendPoll.replyMarkup) &&
+ Objects.equals(openPeriod, sendPoll.openPeriod) &&
+ Objects.equals(closeDate, sendPoll.closeDate) &&
+ Objects.equals(explanation, sendPoll.explanation) &&
+ Objects.equals(explanationParseMode, sendPoll.explanationParseMode);
}
@Override
public int hashCode() {
- return Objects.hash(chatId, question, options, isAnonymous, type, allowMultipleAnswers, correctOptionId,
- isClosed, disableNotification, replyToMessageId, replyMarkup);
+ return Objects.hash(chatId, question, options, isAnonymous, type, allowMultipleAnswers, correctOptionId, isClosed,
+ disableNotification, replyToMessageId, replyMarkup, openPeriod, closeDate, explanation, explanationParseMode);
}
@Override
@@ -275,6 +334,10 @@ public class SendPoll extends BotApiMethod {
", disableNotification=" + disableNotification +
", replyToMessageId=" + replyToMessageId +
", replyMarkup=" + replyMarkup +
+ ", openPeriod=" + openPeriod +
+ ", closeDate=" + closeDate +
+ ", explanation='" + explanation + '\'' +
+ ", explanationParseMode='" + explanationParseMode + '\'' +
'}';
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java
index f2a391f7..24d14cf8 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java
@@ -21,12 +21,15 @@ public class SendDice extends BotApiMethod {
public static final String PATH = "sendDice";
private static final String CHATID_FIELD = "chat_id";
+ private static final String EMOJI_FIELD = "emoji";
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private static final String REPLYMARKUP_FIELD = "reply_markup";
@JsonProperty(CHATID_FIELD)
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ @JsonProperty(EMOJI_FIELD)
+ private String emoji; ///< Optional. Emoji on which the dice throw animation is based. Currently, must be one of “🎲” or “🎯”. Defauts to “🎲”
@JsonProperty(DISABLENOTIFICATION_FIELD)
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.
@JsonProperty(REPLYTOMESSAGEID_FIELD)
@@ -84,6 +87,15 @@ public class SendDice extends BotApiMethod {
return this;
}
+ public String getEmoji() {
+ return emoji;
+ }
+
+ public SendDice setEmoji(String emoji) {
+ this.emoji = emoji;
+ return this;
+ }
+
@Override
public String getMethod() {
return PATH;
@@ -109,6 +121,9 @@ public class SendDice extends BotApiMethod {
if (chatId == null) {
throw new TelegramApiValidationException("ChatId parameter can't be empty", this);
}
+ if (emoji != null && !emoji.equals("“\uD83C\uDFB2") && !emoji.equals("\uD83C\uDFAF")) {
+ throw new TelegramApiValidationException("Only \uD83C\uDFB2 and \uD83C\uDFAF are allowed in Emoji field ", this);
+ }
if (replyMarkup != null) {
replyMarkup.validate();
}
@@ -118,6 +133,7 @@ public class SendDice extends BotApiMethod {
public String toString() {
return "SendDice{" +
"chatId='" + chatId + '\'' +
+ ", emoji='" + emoji + '\'' +
", disableNotification=" + disableNotification +
", replyToMessageId=" + replyToMessageId +
", replyMarkup=" + replyMarkup +
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Dice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Dice.java
index 4efed1a5..2b57eb80 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Dice.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Dice.java
@@ -11,9 +11,12 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
*/
public class Dice implements BotApiObject {
private static final String VALUE_FIELD = "value";
+ private static final String EMOJI_FIELD = "emoji";
@JsonProperty(VALUE_FIELD)
private Integer value; ///< Value of the dice, 1-6
+ @JsonProperty(EMOJI_FIELD)
+ private String emoji; ///< Emoji on which the dice throw animation is based
public Dice() {
super();
@@ -23,10 +26,15 @@ public class Dice implements BotApiObject {
return value;
}
+ public String getEmoji() {
+ return emoji;
+ }
+
@Override
public String toString() {
return "Dice{" +
"value=" + value +
+ ", emoji='" + emoji + '\'' +
'}';
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/Poll.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/Poll.java
index bdf3b97b..f4c62de0 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/Poll.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/polls/Poll.java
@@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.polls;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
+import org.telegram.telegrambots.meta.api.objects.MessageEntity;
import java.util.List;
import java.util.Objects;
@@ -22,6 +23,10 @@ public class Poll implements BotApiObject {
private static final String TYPE_FIELD = "type";
private static final String ALLOWSMULTIPLEANSWERS_FIELD = "allows_multiple_answers";
private static final String CORRECTOPTIONID_FIELD = "correct_option_id";
+ private static final String OPENPERIOD_FIELD = "open_period";
+ private static final String CLOSEDATE_FIELD = "close_date";
+ private static final String EXPLANATION_FIELD = "explanation";
+ private static final String EXPLANATIONENTITIES_FIELD = "explanation_entities";
@JsonProperty(ID_FIELD)
private String id; ///< Unique poll identifier
@@ -47,6 +52,14 @@ public class Poll implements BotApiObject {
*/
@JsonProperty(CORRECTOPTIONID_FIELD)
private Integer correctOptionId; ///< True, if the poll allows multiple answers
+ @JsonProperty(OPENPERIOD_FIELD)
+ private Integer openPeriod; ///< Optional. Amount of time in seconds the poll will be active after creation
+ @JsonProperty(CLOSEDATE_FIELD)
+ private Integer closeDate; ///< Optional. Point in time (Unix timestamp) when the poll will be automatically closed
+ @JsonProperty(EXPLANATION_FIELD)
+ private String explanation; ///< Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
+ @JsonProperty(EXPLANATIONENTITIES_FIELD)
+ private List explanationEntities; ///< Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
public Poll() {
}
@@ -123,6 +136,22 @@ public class Poll implements BotApiObject {
this.correctOptionId = correctOptionId;
}
+ public Integer getOpenPeriod() {
+ return openPeriod;
+ }
+
+ public Integer getCloseDate() {
+ return closeDate;
+ }
+
+ public String getExplanation() {
+ return explanation;
+ }
+
+ public List getExplanationEntities() {
+ return explanationEntities;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -136,12 +165,16 @@ public class Poll implements BotApiObject {
Objects.equals(isAnonymous, poll.isAnonymous) &&
Objects.equals(type, poll.type) &&
Objects.equals(allowMultipleAnswers, poll.allowMultipleAnswers) &&
- Objects.equals(correctOptionId, poll.correctOptionId);
+ Objects.equals(correctOptionId, poll.correctOptionId) &&
+ Objects.equals(openPeriod, poll.openPeriod) &&
+ Objects.equals(closeDate, poll.closeDate) &&
+ Objects.equals(explanation, poll.explanation) &&
+ Objects.equals(explanationEntities, poll.explanationEntities);
}
@Override
public int hashCode() {
- return Objects.hash(id, question, options, totalVoterCount, isClosed, isAnonymous, type, allowMultipleAnswers, correctOptionId);
+ return Objects.hash(id, question, options, totalVoterCount, isClosed, isAnonymous, type, allowMultipleAnswers, correctOptionId, openPeriod, closeDate, explanation, explanationEntities);
}
@Override
@@ -156,6 +189,10 @@ public class Poll implements BotApiObject {
", type='" + type + '\'' +
", allowMultipleAnswers=" + allowMultipleAnswers +
", correctOptionId=" + correctOptionId +
+ ", openPeriod=" + openPeriod +
+ ", closeDate=" + closeDate +
+ ", explanation='" + explanation + '\'' +
+ ", explanationEntities=" + explanationEntities +
'}';
}
}
diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml
index 46c70b31..d9bbc0ff 100644
--- a/telegrambots-spring-boot-starter/pom.xml
+++ b/telegrambots-spring-boot-starter/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.7
+ 4.8
telegrambots-spring-boot-starter
@@ -78,7 +78,7 @@
org.telegram
telegrambots
- 4.7
+ 4.8
org.springframework.boot
diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml
index 045612a3..bc0d00b5 100644
--- a/telegrambots/pom.xml
+++ b/telegrambots/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 4.7
+ 4.8
telegrambots
@@ -95,7 +95,7 @@
org.telegram
telegrambots-meta
- 4.7
+ 4.8
com.fasterxml.jackson.core