commit
b3828accbe
@ -31,8 +31,8 @@ Just import add the library to your project with one of these options:
|
||||
</dependency>
|
||||
```
|
||||
|
||||
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/2.4.4.3)
|
||||
3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/2.4.4.3)
|
||||
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/2.4.4.4)
|
||||
3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/2.4.4.4)
|
||||
|
||||
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.
|
||||
|
||||
|
@ -30,3 +30,8 @@
|
||||
2. Support crating webhook with HTTP servers (HTTPS must be managed via external tools)
|
||||
|
||||
**[[How to update to version 2.4.4.3|How-To-Update#2.4.4.3]]**
|
||||
|
||||
### <a id="2.4.4.4"></a>2.4.4.4 ###
|
||||
1. EditMessageText, EditMessageCaption and EditMessageReplyMarkup now return a `Serializable` object that can be `Boolean` or `Message`
|
||||
|
||||
**[[How to update to version 2.4.4.4|How-To-Update#2.4.4.4]]**
|
@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>2.4.4.3</version>
|
||||
<version>2.4.4.4</version>
|
||||
</dependency>
|
||||
```
|
||||
* With **Gradle**:
|
||||
|
||||
```groovy
|
||||
compile group: 'org.telegram', name: 'telegrambots', version: '2.4.4.3'
|
||||
compile group: 'org.telegram', name: 'telegrambots', version: '2.4.4.4'
|
||||
```
|
||||
|
||||
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
|
||||
|
@ -17,3 +17,7 @@
|
||||
|
||||
### <a id="2.4.4.3"></a>To version 2.4.4.3 ###
|
||||
1. Replace `BotSession.close()` by `BotSession.stop()`.
|
||||
|
||||
### <a id="2.4.4.4"></a>To version 2.4.4.4 ###
|
||||
1. All calls to `editMessageText`, `editMessageCaption` or `editMessageReplyMarkup` in `AbsSender` return value is changed to `Serializable`
|
||||
2. In `editMessageTextAsync`, `editMessageCaptionAsync` or `editMessageReplyMarkupAsync` in `AbsSender`, second parameter should become `SentCallback<Serializable>` due to new return type.
|
4
pom.xml
4
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>Bots</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>2.4.4.3</version>
|
||||
<version>2.4.4.4</version>
|
||||
|
||||
<modules>
|
||||
<module>telegrambots</module>
|
||||
@ -24,6 +24,6 @@
|
||||
|
||||
<properties>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
<bots.version>2.4.4.3</bots.version>
|
||||
<bots.version>2.4.4.4</bots.version>
|
||||
</properties>
|
||||
</project>
|
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots-meta</artifactId>
|
||||
<version>2.4.4.3</version>
|
||||
<version>2.4.4.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Telegram Bots Meta</name>
|
||||
|
@ -11,15 +11,16 @@ import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
|
||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* @brief Use this method to edit captions of messages sent by the bot or via the bot (for inline
|
||||
* bots). On success, the edited Message is returned
|
||||
* bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
|
||||
* @date 10 of April of 2016
|
||||
*/
|
||||
public class EditMessageCaption extends BotApiMethod<Message> {
|
||||
public class EditMessageCaption extends BotApiMethod<Serializable> {
|
||||
public static final String PATH = "editmessagecaption";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
@ -104,7 +105,7 @@ public class EditMessageCaption extends BotApiMethod<Message> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
public Serializable deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
try {
|
||||
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
||||
new TypeReference<ApiResponse<Message>>(){});
|
||||
@ -114,9 +115,20 @@ public class EditMessageCaption extends BotApiMethod<Message> {
|
||||
throw new TelegramApiRequestException("Error editing message caption", result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
|
||||
new TypeReference<ApiResponse<Boolean>>() {
|
||||
});
|
||||
if (result.getOk()) {
|
||||
return result.getResult();
|
||||
} else {
|
||||
throw new TelegramApiRequestException("Error editing message caption", result);
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
throw new TelegramApiRequestException("Unable to deserialize response", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() throws TelegramApiValidationException {
|
||||
|
@ -11,16 +11,18 @@ import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
|
||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* @brief Use this method to edit only the reply markup of messages sent by the bot or via the bot
|
||||
* (for inline bots). On success, the edited Message is returned.
|
||||
* (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned,
|
||||
* therwise True is returned.
|
||||
* @date 10 of April of 2016
|
||||
*/
|
||||
public class EditMessageReplyMarkup extends BotApiMethod<Message> {
|
||||
public class EditMessageReplyMarkup extends BotApiMethod<Serializable> {
|
||||
public static final String PATH = "editmessagereplymarkup";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
@ -99,7 +101,7 @@ public class EditMessageReplyMarkup extends BotApiMethod<Message> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
public Serializable deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
try {
|
||||
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
||||
new TypeReference<ApiResponse<Message>>(){});
|
||||
@ -109,9 +111,20 @@ public class EditMessageReplyMarkup extends BotApiMethod<Message> {
|
||||
throw new TelegramApiRequestException("Error editing message reply markup", result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
|
||||
new TypeReference<ApiResponse<Boolean>>() {
|
||||
});
|
||||
if (result.getOk()) {
|
||||
return result.getResult();
|
||||
} else {
|
||||
throw new TelegramApiRequestException("Error editing message reply markup", result);
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
throw new TelegramApiRequestException("Unable to deserialize response", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() throws TelegramApiValidationException {
|
||||
|
@ -12,16 +12,17 @@ import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
|
||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* @brief Use this method to edit text messages sent by the bot or via the bot (for inline bots). On
|
||||
* success, the edited Message is returned.
|
||||
* success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
|
||||
* @date 10 of April of 2016
|
||||
*/
|
||||
public class EditMessageText extends BotApiMethod<Message> {
|
||||
public class EditMessageText extends BotApiMethod<Serializable> {
|
||||
public static final String PATH = "editmessagetext";
|
||||
|
||||
private static final String CHATID_FIELD = "chat_id";
|
||||
@ -159,7 +160,7 @@ public class EditMessageText extends BotApiMethod<Message> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
public Serializable deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||
try {
|
||||
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
||||
new TypeReference<ApiResponse<Message>>(){});
|
||||
@ -169,9 +170,20 @@ public class EditMessageText extends BotApiMethod<Message> {
|
||||
throw new TelegramApiRequestException("Error editing message text", result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
ApiResponse<Boolean> result = OBJECT_MAPPER.readValue(answer,
|
||||
new TypeReference<ApiResponse<Boolean>>() {
|
||||
});
|
||||
if (result.getOk()) {
|
||||
return result.getResult();
|
||||
} else {
|
||||
throw new TelegramApiRequestException("Error editing message text", result);
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
throw new TelegramApiRequestException("Unable to deserialize response", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() throws TelegramApiValidationException {
|
||||
|
@ -164,21 +164,21 @@ public abstract class AbsSender {
|
||||
return sendApiMethod(getChatMemberCount);
|
||||
}
|
||||
|
||||
public final Message editMessageText(EditMessageText editMessageText) throws TelegramApiException {
|
||||
public final Serializable editMessageText(EditMessageText editMessageText) throws TelegramApiException {
|
||||
if (editMessageText == null) {
|
||||
throw new TelegramApiException("Parameter editMessageText can not be null");
|
||||
}
|
||||
return sendApiMethod(editMessageText);
|
||||
}
|
||||
|
||||
public final Message editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException {
|
||||
public final Serializable editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException {
|
||||
if (editMessageCaption == null) {
|
||||
throw new TelegramApiException("Parameter editMessageCaption can not be null");
|
||||
}
|
||||
return sendApiMethod(editMessageCaption);
|
||||
}
|
||||
|
||||
public final Message editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException {
|
||||
public final Serializable editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException {
|
||||
if (editMessageReplyMarkup == null) {
|
||||
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
|
||||
}
|
||||
@ -407,7 +407,7 @@ public abstract class AbsSender {
|
||||
sendApiMethodAsync(getChatMemberCount, sentCallback);
|
||||
}
|
||||
|
||||
public final void editMessageTextAsync(EditMessageText editMessageText, SentCallback<Message> sentCallback) throws TelegramApiException {
|
||||
public final void editMessageTextAsync(EditMessageText editMessageText, SentCallback<Serializable> sentCallback) throws TelegramApiException {
|
||||
if (editMessageText == null) {
|
||||
throw new TelegramApiException("Parameter editMessageText can not be null");
|
||||
}
|
||||
@ -418,7 +418,7 @@ public abstract class AbsSender {
|
||||
sendApiMethodAsync(editMessageText, sentCallback);
|
||||
}
|
||||
|
||||
public final void editMessageCaptionAsync(EditMessageCaption editMessageCaption, SentCallback<Message> sentCallback) throws TelegramApiException {
|
||||
public final void editMessageCaptionAsync(EditMessageCaption editMessageCaption, SentCallback<Serializable> sentCallback) throws TelegramApiException {
|
||||
if (editMessageCaption == null) {
|
||||
throw new TelegramApiException("Parameter editMessageCaption can not be null");
|
||||
}
|
||||
@ -429,7 +429,7 @@ public abstract class AbsSender {
|
||||
sendApiMethodAsync(editMessageCaption, sentCallback);
|
||||
}
|
||||
|
||||
public final void editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup, SentCallback<Message> sentCallback) throws TelegramApiException {
|
||||
public final void editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup, SentCallback<Serializable> sentCallback) throws TelegramApiException {
|
||||
if (editMessageReplyMarkup == null) {
|
||||
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>2.4.4.3</version>
|
||||
<version>2.4.4.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Telegram Bots</name>
|
||||
@ -65,7 +65,7 @@
|
||||
<json.version>20160810</json.version>
|
||||
<jackson.version>2.8.5</jackson.version>
|
||||
<commonio.version>2.5</commonio.version>
|
||||
<bots.version>2.4.4.3</bots.version>
|
||||
<bots.version>2.4.4.4</bots.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
Loading…
Reference in New Issue
Block a user