diff --git a/README.md b/README.md
index c7ddef60..abb79697 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
- 5.0.0
+ 5.0.1
```
```gradle
- compile "org.telegram:telegrambots:5.0.0"
+ compile "org.telegram:telegrambots:5.0.1"
```
- 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.0.0)
- 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.0.0)
+ 2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.0.1)
+ 3. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.0.1)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
@@ -50,8 +50,8 @@ Once done, you just need to create a `org.telegram.telegrambots.meta.TelegramBot
// Example taken from https://github.com/rubenlagus/TelegramBotsExample
public class Main {
public static void main(String[] args) {
- TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);
try {
+ TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);
telegramBotsApi.registerBot(new ChannelHandlers());
telegramBotsApi.registerBot(new DirectionsHandlers());
telegramBotsApi.registerBot(new RaeHandlers());
diff --git a/TelegramBots.wiki/Changelog.md b/TelegramBots.wiki/Changelog.md
index 2d9b6174..adb8a126 100644
--- a/TelegramBots.wiki/Changelog.md
+++ b/TelegramBots.wiki/Changelog.md
@@ -1,5 +1,11 @@
+### 5.0.1 ###
+1. Fixing couple of bugs from 5.0.0
+2. Buf fixing: #794
+3. Docs updated to reflect usage for version 5.0.0
+4. EditMessageText setChatIId(Long) is removed to keep consistency
+
### 5.0.0 ###
-1. Update Api version [5.0](https://core.telegram.org/bots/api-changelog#june-4-2020)
+1. Update Api version [5.0](https://core.telegram.org/bots/api-changelog#november-4-2020)
2. Added Builders for many of the API methods and objects (hopefully all of them unless I missed something)
3. Some setters/getters may have change name. They no longer return a reference to itself, use Builder for that.
4. Simplified methods to set files in methods. Only InputFile is available now (this class contains constructors for all the cases)
diff --git a/TelegramBots.wiki/FAQ.md b/TelegramBots.wiki/FAQ.md
index a54758e1..a296ec59 100644
--- a/TelegramBots.wiki/FAQ.md
+++ b/TelegramBots.wiki/FAQ.md
@@ -79,29 +79,29 @@ Quick example here that is showing ChactActions for commands like "/type" or "/r
```java
if (update.hasMessage() && update.getMessage().hasText()) {
- String text = update.getMessage().getText();
+ String text = update.getMessage().getText();
- SendChatAction sendChatAction = new SendChatAction();
- sendChatAction.setChatId(update.getMessage().getChatId());
+ SendChatAction sendChatAction = new SendChatAction();
+ sendChatAction.setChatId(update.getMessage().getChatId());
- if (text.equals("/type")) {
- // -> "typing"
- sendChatAction.setAction(ActionType.TYPING);
- // -> "recording a voice message"
- } else if (text.equals("/record_audio")) {
- sendChatAction.setAction(ActionType.RECORDAUDIO);
- } else {
- // -> more actions in the Enum ActionType
- // For information: https://core.telegram.org/bots/api#sendchataction
- sendChatAction.setAction(ActionType.UPLOADDOCUMENT);
- }
+ if (text.equals("/type")) {
+ // -> "typing"
+ sendChatAction.setAction(ActionType.TYPING);
+ // -> "recording a voice message"
+ } else if (text.equals("/record_audio")) {
+ sendChatAction.setAction(ActionType.RECORDAUDIO);
+ } else {
+ // -> more actions in the Enum ActionType
+ // For information: https://core.telegram.org/bots/api#sendchataction
+ sendChatAction.setAction(ActionType.UPLOADDOCUMENT);
+ }
- try {
- Boolean wasSuccessfull = execute(sendChatAction);
- } catch (TelegramApiException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ try {
+ Boolean wasSuccessfull = execute(sendChatAction);
+ } catch (TelegramApiException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
```
@@ -116,7 +116,7 @@ There are several method to send a photo to an user using `sendPhoto` method: Wi
// Set destination chat id
sendPhotoRequest.setChatId(chatId);
// Set the photo url as a simple photo
- sendPhotoRequest.setPhoto(url);
+ sendPhotoRequest.setPhoto(new InputFile(url));
try {
// Execute the method
execute(sendPhotoRequest);
@@ -131,7 +131,7 @@ There are several method to send a photo to an user using `sendPhoto` method: Wi
// Set destination chat id
sendPhotoRequest.setChatId(chatId);
// Set the photo url as a simple photo
- sendPhotoRequest.setPhoto(fileId);
+ sendPhotoRequest.setPhoto(new InputFile(fileId));
try {
// Execute the method
execute(sendPhotoRequest);
@@ -145,8 +145,8 @@ There are several method to send a photo to an user using `sendPhoto` method: Wi
SendPhoto sendPhotoRequest = new SendPhoto();
// Set destination chat id
sendPhotoRequest.setChatId(chatId);
- // Set the photo file as a new photo (You can also use InputStream with a method overload)
- sendPhotoRequest.setNewPhoto(new File(filePath));
+ // Set the photo file as a new photo (You can also use InputStream with a constructor overload)
+ sendPhotoRequest.setPhoto(new InputFile(new File(filePath)));
try {
// Execute the method
execute(sendPhotoRequest);
@@ -162,24 +162,23 @@ In this example we will check if user sends to bot a photo, if it is, get Photo'
```java
// If it is a photo
if (update.hasMessage() && update.getMessage().hasPhoto()) {
- // Array with photos
- List photos = update.getMessage().getPhoto();
- // Get largest photo's file_id
- String f_id = photos.stream()
- .sorted(Comparator.comparing(PhotoSize::getFileSize).reversed())
- .findFirst()
- .orElse(null).getFileId();
- // Send photo by file_id we got before
- SendPhoto msg = new SendPhoto()
- .setChatId(update.getMessage().getChatId())
- .setPhoto(f_id)
- .setCaption("Photo");
- try {
- execute(msg); // Call method to send the photo
- } catch (TelegramApiException e) {
- e.printStackTrace();
- }
- }
+ // Array with photos
+ List photos = update.getMessage().getPhoto();
+ // Get largest photo's file_id
+ String f_id = photos.stream()
+ .max(Comparator.comparing(PhotoSize::getFileSize))
+ .orElseThrow().getFileId();
+ // Send photo by file_id we got before
+ SendPhoto msg = new SendPhoto()
+ .setChatId(update.getMessage().getChatId())
+ .setPhoto(new InputFile(f_id))
+ .setCaption("Photo");
+ try {
+ execute(msg); // Call method to send the photo
+ } catch (TelegramApiException e) {
+ e.printStackTrace();
+ }
+}
```
## How to use custom keyboards? ##
@@ -264,9 +263,9 @@ Your main spring boot class should look like this:
@SpringBootApplication
public class YourApplicationMainClass {
- public static void main(String[] args) {
- SpringApplication.run(YourApplicationMainClass.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(YourApplicationMainClass.class, args);
+ }
}
```
diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md
index 53ffab72..0c8907ca 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
- 5.0.0
+ 5.0.1
```
* With **Gradle**:
```groovy
- compile group: 'org.telegram', name: 'telegrambots', version: '5.0.0'
+ compile group: 'org.telegram', name: 'telegrambots', version: '5.0.1'
```
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
@@ -135,9 +135,8 @@ Now that we have the library, we can start coding. There are few steps to follow
public class Main {
public static void main(String[] args) {
- TelegramBotsApi botsApi = new TelegramBotsApi();
-
try {
+ TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
botsApi.registerBot(new MyAmazingBot());
} catch (TelegramApiException e) {
e.printStackTrace();
diff --git a/TelegramBots.wiki/Using-Http-Proxy.md b/TelegramBots.wiki/Using-Http-Proxy.md
index 2a44a9c2..ea0833d5 100644
--- a/TelegramBots.wiki/Using-Http-Proxy.md
+++ b/TelegramBots.wiki/Using-Http-Proxy.md
@@ -94,7 +94,7 @@ public class Main {
});
// Create the TelegramBotsApi object to register your bots
- TelegramBotsApi botsApi = new TelegramBotsApi();
+ TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
// Set up Http proxy
DefaultBotOptions botOptions = new DefaultBotOptions();
diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md
index 7c3b7326..ca569282 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
- 5.0.0
+ 5.0.1
```
* **Gradle**
```groovy
- implementation group: 'org.telegram', name: 'telegrambots-abilities', version: '5.0.0'
+ implementation group: 'org.telegram', name: 'telegrambots-abilities', version: '5.0.1'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)
@@ -81,10 +81,10 @@ Running the bot is just like running the regular Telegram bots. Create a Java cl
```java
public class Application {
public static void main(String[] args) {
- // Create the TelegramBotsApi object to register your bots
- TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
-
try {
+ // Create the TelegramBotsApi object to register your bots
+ TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
+
// Register your newly created AbilityBot
botsApi.registerBot(new HelloBot());
} catch (TelegramApiException e) {
diff --git a/pom.xml b/pom.xml
index d96c1f85..08cae031 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
pom
- 5.0.0
+ 5.0.1
telegrambots
diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md
index 6c58330e..52d18fe0 100644
--- a/telegrambots-abilities/README.md
+++ b/telegrambots-abilities/README.md
@@ -18,19 +18,19 @@ Usage
org.telegram
telegrambots-abilities
- 5.0.0
+ 5.0.1
```
**Gradle**
```gradle
- compile "org.telegram:telegrambots-abilities:5.0.0"
+ compile "org.telegram:telegrambots-abilities:5.0.1"
```
-**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.0)
+**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1)
-**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v5.0.0)
+**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v5.0.1)
Motivation
----------
diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml
index 7d4b10fb..a5429c14 100644
--- a/telegrambots-abilities/pom.xml
+++ b/telegrambots-abilities/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.0.0
+ 5.0.1
telegrambots-abilities
@@ -84,7 +84,7 @@
org.telegram
telegrambots
- 5.0.0
+ 5.0.1
org.apache.commons
diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md
index 5cfd0cf7..99446945 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
- 5.0.0
+ 5.0.1
```
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index 00b9368f..4d83e7e2 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.0.0
+ 5.0.1
telegrambots-chat-session-bot
@@ -84,7 +84,7 @@
org.telegram
telegrambots
- 5.0.0
+ 5.0.1
diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md
index e56cf766..5deffb45 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
- 5.0.0
+ 5.0.1
```
2. Using Gradle:
```gradle
- compile "org.telegram:telegrambotsextensions:5.0.0"
+ compile "org.telegram:telegrambotsextensions:5.0.1"
```
\ No newline at end of file
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index 4dd00ed0..6e6fad0d 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.0.0
+ 5.0.1
telegrambotsextensions
@@ -75,7 +75,7 @@
org.telegram
telegrambots
- 5.0.0
+ 5.0.1
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index c88a2c7c..e5b7595e 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.0.0
+ 5.0.1
telegrambots-meta
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/commands/GetMyCommands.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/commands/GetMyCommands.java
index ea339716..4fb9c343 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/commands/GetMyCommands.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/commands/GetMyCommands.java
@@ -1,10 +1,10 @@
package org.telegram.telegrambots.meta.api.methods.commands;
import com.fasterxml.jackson.core.type.TypeReference;
+import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
-import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
@@ -27,7 +27,7 @@ import java.util.ArrayList;
@Getter
@Setter
@ToString
-@NoArgsConstructor
+@AllArgsConstructor
@Builder
public class GetMyCommands extends BotApiMethod> {
public static final String PATH = "getMyCommands";
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/Close.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/Close.java
index 0e40a1f1..73f461c4 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/Close.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/Close.java
@@ -1,15 +1,14 @@
package org.telegram.telegrambots.meta.api.methods.updates;
import com.fasterxml.jackson.core.type.TypeReference;
+import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
-import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
-import org.telegram.telegrambots.meta.api.objects.WebhookInfo;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@@ -28,9 +27,9 @@ import java.io.IOException;
@Getter
@Setter
@ToString
-@NoArgsConstructor
+@AllArgsConstructor
@Builder
-public class Close extends BotApiMethod {
+public class Close extends BotApiMethod {
public static final String PATH = "close";
@Override
@@ -39,15 +38,15 @@ public class Close extends BotApiMethod {
}
@Override
- public WebhookInfo deserializeResponse(String answer) throws TelegramApiRequestException {
+ public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
- ApiResponse result = OBJECT_MAPPER.readValue(answer,
- new TypeReference>() {
+ ApiResponse result = OBJECT_MAPPER.readValue(answer,
+ new TypeReference>() {
});
if (result.getOk()) {
return result.getResult();
} else {
- throw new TelegramApiRequestException("Error logging out info", result);
+ throw new TelegramApiRequestException("Error closing", result);
}
} catch (IOException e2) {
throw new TelegramApiRequestException("Unable to deserialize response", e2);
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/LogOut.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/LogOut.java
index 5fa8dea4..bf549d1c 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/LogOut.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updates/LogOut.java
@@ -9,7 +9,6 @@ import lombok.Setter;
import lombok.ToString;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
-import org.telegram.telegrambots.meta.api.objects.WebhookInfo;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@@ -30,7 +29,7 @@ import java.io.IOException;
@ToString
@AllArgsConstructor
@Builder
-public class LogOut extends BotApiMethod {
+public class LogOut extends BotApiMethod {
public static final String PATH = "logOut";
@Override
@@ -39,15 +38,15 @@ public class LogOut extends BotApiMethod {
}
@Override
- public WebhookInfo deserializeResponse(String answer) throws TelegramApiRequestException {
+ public Boolean deserializeResponse(String answer) throws TelegramApiRequestException {
try {
- ApiResponse result = OBJECT_MAPPER.readValue(answer,
- new TypeReference>() {
+ ApiResponse result = OBJECT_MAPPER.readValue(answer,
+ new TypeReference>() {
});
if (result.getOk()) {
return result.getResult();
} else {
- throw new TelegramApiRequestException("Error logging out info", result);
+ throw new TelegramApiRequestException("Error logging out", result);
}
} catch (IOException e2) {
throw new TelegramApiRequestException("Unable to deserialize response", e2);
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java
index 850fa5a3..a268347a 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageText.java
@@ -86,10 +86,6 @@ public class EditMessageText extends BotApiMethod {
@JsonProperty(ENTITIES_FIELD)
private List entities; ///< Optional. List of special entities that appear in message text, which can be specified instead of parse_mode
- public void setChatId(Long chatId) {
- this.chatId = chatId.toString();
- }
-
public void disableWebPagePreview() {
disableWebPagePreview = true;
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java
index e75e9d66..40f52f2b 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPermissions.java
@@ -37,7 +37,7 @@ public class ChatPermissions implements BotApiObject {
@JsonProperty(CAN_SEND_MESSAGES_FIELD)
private Boolean canSendMessages; ///< Optional. True, if the user is allowed to send text messages, contacts, locations and venues
@JsonProperty(CAN_SEND_MEDIA_MESSAGES_FIELD)
- private Boolean getCanSendMediaMessages; ///< Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
+ private Boolean canSendMediaMessages; ///< Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
@JsonProperty(CAN_SEND_POLLS_FIELD)
private Boolean canSendPolls; ///< Optional. True, if the user is allowed to send polls, implies can_send_messages
@JsonProperty(CAN_SEND_OTHER_MESSAGES_FIELD)
diff --git a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestDeserialization.java b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestDeserialization.java
index 9c351069..aeb8b0e8 100644
--- a/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestDeserialization.java
+++ b/telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/test/TestDeserialization.java
@@ -5,7 +5,10 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.telegram.telegrambots.meta.api.methods.commands.GetMyCommands;
+import org.telegram.telegrambots.meta.api.methods.updates.Close;
import org.telegram.telegrambots.meta.api.methods.updates.GetUpdates;
+import org.telegram.telegrambots.meta.api.methods.updates.LogOut;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Audio;
import org.telegram.telegrambots.meta.api.objects.CallbackQuery;
@@ -17,6 +20,7 @@ import org.telegram.telegrambots.meta.api.objects.MessageEntity;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.api.objects.User;
import org.telegram.telegrambots.meta.api.objects.Voice;
+import org.telegram.telegrambots.meta.api.objects.commands.BotCommand;
import org.telegram.telegrambots.meta.api.objects.inlinequery.ChosenInlineQuery;
import org.telegram.telegrambots.meta.api.objects.inlinequery.InlineQuery;
@@ -151,6 +155,50 @@ class TestDeserialization {
}
}
+ @Test
+ void TestDeserializationCloseMethod() throws Exception {
+ String updateText = "{\"ok\":true,\"result\": true}";
+
+ Boolean response = new Close().deserializeResponse(updateText);
+
+ assertTrue(response);
+ }
+
+ @Test
+ void TestDeserializationLogoutMethod() throws Exception {
+ String updateText = "{\"ok\":true,\"result\": true}";
+
+ Boolean response = new LogOut().deserializeResponse(updateText);
+
+ assertTrue(response);
+ }
+
+ @Test
+ void TestDeserializationGetMyCommandsMethod() throws Exception {
+ String updateText = "{\n" +
+ " \"ok\": true,\n" +
+ " \"result\": [\n" +
+ " {\n" +
+ " \"command\": \"enabled\",\n" +
+ " \"description\": \"Enabled Command\"\n" +
+ " },\n" +
+ " {\n" +
+ " \"command\": \"disabled\",\n" +
+ " \"description\": \"Disabled Command\"\n" +
+ " }\n" +
+ " ]\n" +
+ "}";
+
+ ArrayList response = new GetMyCommands().deserializeResponse(updateText);
+
+ assertNotNull(response);
+ assertEquals(2, response.size());
+ assertEquals("enabled", response.get(0).getCommand());
+ assertEquals("Enabled Command", response.get(0).getDescription());
+ assertEquals("disabled", response.get(1).getCommand());
+ assertEquals("Disabled Command", response.get(1).getDescription());
+ }
+
@Test
void TestUpdateDeserialization() throws Exception {
Update update = mapper.readValue(TelegramBotsHelper.GetUpdate(), Update.class);
diff --git a/telegrambots-spring-boot-starter/README.md b/telegrambots-spring-boot-starter/README.md
index 1548f833..5501393d 100644
--- a/telegrambots-spring-boot-starter/README.md
+++ b/telegrambots-spring-boot-starter/README.md
@@ -18,14 +18,14 @@ Usage
org.telegram
telegrambots-spring-boot-starter
- 5.0.0
+ 5.0.1
```
**Gradle**
```gradle
- compile "org.telegram:telegrambots-spring-boot-starter:5.0.0"
+ compile "org.telegram:telegrambots-spring-boot-starter:5.0.1"
```
Motivation
diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml
index 08f21a38..914e3e54 100644
--- a/telegrambots-spring-boot-starter/pom.xml
+++ b/telegrambots-spring-boot-starter/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.0.0
+ 5.0.1
telegrambots-spring-boot-starter
@@ -70,7 +70,7 @@
UTF-8
UTF-8
- 5.0.0
+ 5.0.1
2.3.5.RELEASE
3.18.0
diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml
index 7d5da3ac..37143391 100644
--- a/telegrambots/pom.xml
+++ b/telegrambots/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
- 5.0.0
+ 5.0.1
telegrambots
@@ -92,7 +92,7 @@
org.telegram
telegrambots-meta
- 5.0.0
+ 5.0.1
org.projectlombok