diff --git a/Bots.ipr b/Bots.ipr
index 192e8d50..6385b5db 100644
--- a/Bots.ipr
+++ b/Bots.ipr
@@ -1846,6 +1846,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1859,6 +1872,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index bfca2565..7f22def8 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.2
+ 4.3
```
```gradle
- compile "org.telegram:telegrambots:4.2"
+ compile "org.telegram:telegrambots:4.3"
```
- 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.2)
- 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.2)
+ 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.3)
+ 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/4.3)
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 3c1f41b2..32e9ed25 100644
--- a/TelegramBots.wiki/Changelog.md
+++ b/TelegramBots.wiki/Changelog.md
@@ -1,3 +1,7 @@
+### 4.3 ###
+1. Update to Api version [4.3](https://core.telegram.org/bots/api-changelog#may-31-2019)
+2. Fixed: #615, #621
+
### 4.2 ###
1. Update to Api version [4.2](https://core.telegram.org/bots/api-changelog#april-14-2019)
2. Fixed: #498, #578
diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md
index 5be85217..15329753 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.2
+ 4.3
```
* With **Gradle**:
```groovy
- compile group: 'org.telegram', name: 'telegrambots', version: '4.2'
+ compile group: 'org.telegram', name: 'telegrambots', version: '4.3'
```
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 b6fadb98..08cd72f3 100644
--- a/TelegramBots.wiki/abilities/Simple-Example.md
+++ b/TelegramBots.wiki/abilities/Simple-Example.md
@@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
org.telegram
telegrambots-abilities
- 4.2
+ 4.3
```
* **Gradle**
```groovy
- compile group: 'org.telegram', name: 'telegrambots-abilities', version: '4.2'
+ compile group: 'org.telegram', name: 'telegrambots-abilities', version: '4.3'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)
diff --git a/pom.xml b/pom.xml
index 32c3cbed..52dfbb1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
pom
- 4.2
+ 4.3
telegrambots
diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md
index f103fdaa..dae9c753 100644
--- a/telegrambots-abilities/README.md
+++ b/telegrambots-abilities/README.md
@@ -18,19 +18,19 @@ Usage
org.telegram
telegrambots-abilities
- 4.2
+ 4.3
```
**Gradle**
```gradle
- compile "org.telegram:telegrambots-abilities:4.2"
+ compile "org.telegram:telegrambots-abilities:4.3"
```
-**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.2)
+**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.3)
-**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.2)
+**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.3)
Motivation
----------
diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml
index 16f39760..45e5f497 100644
--- a/telegrambots-abilities/pom.xml
+++ b/telegrambots-abilities/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-abilities
- 4.2
+ 4.3
jar
Telegram Ability Bot
@@ -73,7 +73,7 @@
org.telegram
telegrambots
- 4.2
+ 4.3
org.apache.commons
diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md
index 0f3179fc..15f4eda3 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.2
+ 4.3
```
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index a6794d35..3ce0bb3d 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-chat-session-bot
- 4.2
+ 4.3
jar
Telegram Bots Chat Session Bot
@@ -73,7 +73,7 @@
org.telegram
telegrambots
- 4.2
+ 4.3
diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md
index 7136259b..3b5f1d4a 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.2
+ 4.3
```
2. Using Gradle:
```gradle
- compile "org.telegram:telegrambotsextensions:4.2"
+ compile "org.telegram:telegrambotsextensions:4.3"
```
\ No newline at end of file
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index ad8d4e3d..e347a79a 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambotsextensions
- 4.2
+ 4.3
jar
Telegram Bots Extensions
@@ -65,7 +65,7 @@
org.telegram
telegrambots
- 4.2
+ 4.3
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index c4774803..9251b46a 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-meta
- 4.2
+ 4.3
jar
Telegram Bots Meta
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/interfaces/InputBotApiObject.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/interfaces/InputBotApiObject.java
index caedb298..291102f5 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/interfaces/InputBotApiObject.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/interfaces/InputBotApiObject.java
@@ -13,6 +13,6 @@ import java.io.Serializable;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, property="@class")
public interface InputBotApiObject extends Serializable {
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/LoginUrl.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/LoginUrl.java
new file mode 100644
index 00000000..c422d9c8
--- /dev/null
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/LoginUrl.java
@@ -0,0 +1,108 @@
+package org.telegram.telegrambots.meta.api.objects;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
+import org.telegram.telegrambots.meta.api.interfaces.Validable;
+import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * @author Ruben Bermudez
+ * @version 4.3
+ *
+ * This object represents a parameter of the inline keyboard button used to automatically authorize a user.
+ * Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram.
+ * All the user needs to do is tap/click a button and confirm that they want to log in.
+ */
+@SuppressWarnings("unused")
+public class LoginUrl implements InputBotApiObject, Validable {
+ private static final String URL_FIELD = "url";
+ private static final String FORWARD_TEXT_FIELD = "forward_text";
+ private static final String BOT_USERNAME_FIELD = "bot_username";
+ private static final String REQUEST_WRITE_ACCESS_FIELD = "request_write_access";
+
+ /**
+ * An HTTP URL to be opened with user authorization data added to the query string when the button is pressed.
+ * If the user refuses to provide authorization data, the original URL without information about the user will be opened.
+ * The data added is the same as described in Receiving authorization data.
+ *
+ * @implNote You must always check the hash of the received data to verify the authentication and the integrity
+ * of the data as described in Checking authorization.
+ */
+ @JsonProperty(URL_FIELD)
+ private String url;
+ @JsonProperty(FORWARD_TEXT_FIELD)
+ private String forwardText; ///< Optional. New text of the button in forwarded messages.
+ /**
+ * Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details.
+ * If not specified, the current bot's username will be assumed.
+ * The url's domain must be the same as the domain linked with the bot.
+ */
+ @JsonProperty(BOT_USERNAME_FIELD)
+ private String botUsername; ///< Optional. Animation duration
+ @JsonProperty(REQUEST_WRITE_ACCESS_FIELD)
+ private Boolean requestWriteAccess; ///< Optional. Pass True to request the permission for your bot to send messages to the user.
+
+ public LoginUrl() {
+ super();
+ }
+
+ public LoginUrl(String url) {
+ this.url = checkNotNull(url);
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public LoginUrl setUrl(String url) {
+ this.url = url;
+ return this;
+ }
+
+ public String getForwardText() {
+ return forwardText;
+ }
+
+ public LoginUrl setForwardText(String forwardText) {
+ this.forwardText = forwardText;
+ return this;
+ }
+
+ public String getBotUsername() {
+ return botUsername;
+ }
+
+ public LoginUrl setBotUsername(String botUsername) {
+ this.botUsername = botUsername;
+ return this;
+
+ }
+
+ public Boolean getRequestWriteAccess() {
+ return requestWriteAccess;
+ }
+
+ public LoginUrl setRequestWriteAccess(Boolean requestWriteAccess) {
+ this.requestWriteAccess = requestWriteAccess;
+ return this;
+ }
+
+ @Override
+ public void validate() throws TelegramApiValidationException {
+ if (url == null || url.isEmpty()) {
+ throw new TelegramApiValidationException("Url parameter can't be empty", this);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "LoginUrl{" +
+ "url='" + url + '\'' +
+ ", forwardText='" + forwardText + '\'' +
+ ", botUsername='" + botUsername + '\'' +
+ ", requestWriteAccess=" + requestWriteAccess +
+ '}';
+ }
+}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java
index 7d606666..b5d010b7 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/Message.java
@@ -8,6 +8,7 @@ import org.telegram.telegrambots.meta.api.objects.passport.PassportData;
import org.telegram.telegrambots.meta.api.objects.payments.Invoice;
import org.telegram.telegrambots.meta.api.objects.payments.SuccessfulPayment;
import org.telegram.telegrambots.meta.api.objects.polls.Poll;
+import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.api.objects.stickers.Sticker;
import java.util.ArrayList;
@@ -65,6 +66,7 @@ public class Message implements BotApiObject {
private static final String PASSPORTDATA_FIELD = "passport_data";
private static final String FORWARDSENDERNAME_FIELD = "forward_sender_name";
private static final String POLL_FIELD = "poll";
+ private static final String REPLY_MARKUP_FIELD = "reply_markup";
@JsonProperty(MESSAGEID_FIELD)
private Integer messageId; ///< Integer Unique message identifier
@@ -198,6 +200,13 @@ public class Message implements BotApiObject {
private String forwardSenderName; ///< Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages.
@JsonProperty(POLL_FIELD)
private Poll poll; ///< Optional. Message is a native poll, information about the poll
+ /**
+ * Inline keyboard attached to the message.
+ *
+ * @apiNote login_url buttons are represented as ordinary url buttons.
+ */
+ @JsonProperty(REPLY_MARKUP_FIELD)
+ private InlineKeyboardMarkup replyMarkup;
public Message() {
super();
@@ -501,6 +510,14 @@ public class Message implements BotApiObject {
return poll;
}
+ public boolean hasReplyMarkup() {
+ return replyMarkup != null;
+ }
+
+ public InlineKeyboardMarkup getReplyMarkup() {
+ return replyMarkup;
+ }
+
@Override
public String toString() {
return "Message{" +
@@ -522,6 +539,7 @@ public class Message implements BotApiObject {
", contact=" + contact +
", location=" + location +
", venue=" + venue +
+ ", animation=" + animation +
", pinnedMessage=" + pinnedMessage +
", newChatMembers=" + newChatMembers +
", leftChatMember=" + leftChatMember +
@@ -547,7 +565,9 @@ public class Message implements BotApiObject {
", mediaGroupId='" + mediaGroupId + '\'' +
", connectedWebsite='" + connectedWebsite + '\'' +
", passportData=" + passportData +
+ ", forwardSenderName='" + forwardSenderName + '\'' +
", poll=" + poll +
+ ", replyMarkup=" + replyMarkup +
'}';
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java
index 8b0171fc..7bd349fb 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java
@@ -3,6 +3,7 @@ package org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
import org.telegram.telegrambots.meta.api.interfaces.Validable;
+import org.telegram.telegrambots.meta.api.objects.LoginUrl;
import org.telegram.telegrambots.meta.api.objects.games.CallbackGame;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@@ -27,6 +28,7 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
private static final String SWITCH_INLINE_QUERY_FIELD = "switch_inline_query";
private static final String SWITCH_INLINE_QUERY_CURRENT_CHAT_FIELD = "switch_inline_query_current_chat";
private static final String PAY_FIELD = "pay";
+ private static final String LOGIN_URL_FIELD = "login_url";
@JsonProperty(TEXT_FIELD)
private String text; ///< Label text on the button
@@ -69,6 +71,12 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
*/
@JsonProperty(PAY_FIELD)
private Boolean pay;
+ /**
+ * Optional. An HTTP URL used to automatically authorize the user.
+ * Can be used as a replacement for the Telegram Login Widget.
+ */
+ @JsonProperty(LOGIN_URL_FIELD)
+ private LoginUrl loginUrl;
public InlineKeyboardButton() {
super();
@@ -141,11 +149,23 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
return this;
}
+ public LoginUrl getLoginUrl() {
+ return loginUrl;
+ }
+
+ public InlineKeyboardButton setLoginUrl(LoginUrl loginUrl) {
+ this.loginUrl = loginUrl;
+ return this;
+ }
+
@Override
public void validate() throws TelegramApiValidationException {
if (text == null || text.isEmpty()) {
throw new TelegramApiValidationException("Text parameter can't be empty", this);
}
+ if (loginUrl != null) {
+ loginUrl.validate();
+ }
}
@Override
@@ -162,6 +182,7 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
&& Objects.equals(switchInlineQueryCurrentChat, inlineKeyboardButton.switchInlineQueryCurrentChat)
&& Objects.equals(text, inlineKeyboardButton.text)
&& Objects.equals(url, inlineKeyboardButton.url)
+ && Objects.equals(loginUrl, inlineKeyboardButton.loginUrl)
;
}
@@ -174,7 +195,8 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
switchInlineQuery,
switchInlineQueryCurrentChat,
text,
- url);
+ url,
+ loginUrl);
}
@Override
@@ -187,6 +209,7 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
", switchInlineQuery='" + switchInlineQuery + '\'' +
", switchInlineQueryCurrentChat='" + switchInlineQueryCurrentChat + '\'' +
", pay=" + pay +
+ ", loginUrl=" + loginUrl +
'}';
}
}
diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml
index 43a31c6f..277c15a9 100644
--- a/telegrambots-spring-boot-starter/pom.xml
+++ b/telegrambots-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-spring-boot-starter
- 4.2
+ 4.3
jar
Telegram Bots Spring Boot Starter
@@ -67,7 +67,7 @@
org.telegram
telegrambots
- 4.2
+ 4.3
org.springframework.boot
diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml
index 413ea2e3..66e04d73 100644
--- a/telegrambots/pom.xml
+++ b/telegrambots/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots
- 4.2
+ 4.3
jar
Telegram Bots
@@ -84,7 +84,7 @@
org.telegram
telegrambots-meta
- 4.2
+ 4.3
com.fasterxml.jackson.core