commit
b3828accbe
@ -31,8 +31,8 @@ Just import add the library to your project with one of these options:
|
|||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/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.3)
|
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`.
|
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)
|
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]]**
|
**[[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>
|
<dependency>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>2.4.4.3</version>
|
<version>2.4.4.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
* With **Gradle**:
|
* With **Gradle**:
|
||||||
|
|
||||||
```groovy
|
```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).
|
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 ###
|
### <a id="2.4.4.3"></a>To version 2.4.4.3 ###
|
||||||
1. Replace `BotSession.close()` by `BotSession.stop()`.
|
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>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>Bots</artifactId>
|
<artifactId>Bots</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>2.4.4.3</version>
|
<version>2.4.4.4</version>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>telegrambots</module>
|
<module>telegrambots</module>
|
||||||
@ -24,6 +24,6 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.deploy.skip>true</maven.deploy.skip>
|
<maven.deploy.skip>true</maven.deploy.skip>
|
||||||
<bots.version>2.4.4.3</bots.version>
|
<bots.version>2.4.4.4</bots.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots-meta</artifactId>
|
<artifactId>telegrambots-meta</artifactId>
|
||||||
<version>2.4.4.3</version>
|
<version>2.4.4.4</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Telegram Bots Meta</name>
|
<name>Telegram Bots Meta</name>
|
||||||
|
@ -11,15 +11,16 @@ import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
|
|||||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief Use this method to edit captions of messages sent by the bot or via the bot (for inline
|
* @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
|
* @date 10 of April of 2016
|
||||||
*/
|
*/
|
||||||
public class EditMessageCaption extends BotApiMethod<Message> {
|
public class EditMessageCaption extends BotApiMethod<Serializable> {
|
||||||
public static final String PATH = "editmessagecaption";
|
public static final String PATH = "editmessagecaption";
|
||||||
|
|
||||||
private static final String CHATID_FIELD = "chat_id";
|
private static final String CHATID_FIELD = "chat_id";
|
||||||
@ -104,7 +105,7 @@ public class EditMessageCaption extends BotApiMethod<Message> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Message deserializeResponse(String answer) throws TelegramApiRequestException {
|
public Serializable deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||||
try {
|
try {
|
||||||
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
||||||
new TypeReference<ApiResponse<Message>>(){});
|
new TypeReference<ApiResponse<Message>>(){});
|
||||||
@ -114,9 +115,20 @@ public class EditMessageCaption extends BotApiMethod<Message> {
|
|||||||
throw new TelegramApiRequestException("Error editing message caption", result);
|
throw new TelegramApiRequestException("Error editing message caption", result);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} 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);
|
throw new TelegramApiRequestException("Unable to deserialize response", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
|
@ -11,16 +11,18 @@ import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
|
|||||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief Use this method to edit only the reply markup of messages sent by the bot or via the bot
|
* @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
|
* @date 10 of April of 2016
|
||||||
*/
|
*/
|
||||||
public class EditMessageReplyMarkup extends BotApiMethod<Message> {
|
public class EditMessageReplyMarkup extends BotApiMethod<Serializable> {
|
||||||
public static final String PATH = "editmessagereplymarkup";
|
public static final String PATH = "editmessagereplymarkup";
|
||||||
|
|
||||||
private static final String CHATID_FIELD = "chat_id";
|
private static final String CHATID_FIELD = "chat_id";
|
||||||
@ -99,7 +101,7 @@ public class EditMessageReplyMarkup extends BotApiMethod<Message> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Message deserializeResponse(String answer) throws TelegramApiRequestException {
|
public Serializable deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||||
try {
|
try {
|
||||||
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
||||||
new TypeReference<ApiResponse<Message>>(){});
|
new TypeReference<ApiResponse<Message>>(){});
|
||||||
@ -109,9 +111,20 @@ public class EditMessageReplyMarkup extends BotApiMethod<Message> {
|
|||||||
throw new TelegramApiRequestException("Error editing message reply markup", result);
|
throw new TelegramApiRequestException("Error editing message reply markup", result);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} 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);
|
throw new TelegramApiRequestException("Unable to deserialize response", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
|
@ -12,16 +12,17 @@ import org.telegram.telegrambots.exceptions.TelegramApiRequestException;
|
|||||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief Use this method to edit text messages sent by the bot or via the bot (for inline bots). On
|
* @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
|
* @date 10 of April of 2016
|
||||||
*/
|
*/
|
||||||
public class EditMessageText extends BotApiMethod<Message> {
|
public class EditMessageText extends BotApiMethod<Serializable> {
|
||||||
public static final String PATH = "editmessagetext";
|
public static final String PATH = "editmessagetext";
|
||||||
|
|
||||||
private static final String CHATID_FIELD = "chat_id";
|
private static final String CHATID_FIELD = "chat_id";
|
||||||
@ -159,7 +160,7 @@ public class EditMessageText extends BotApiMethod<Message> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Message deserializeResponse(String answer) throws TelegramApiRequestException {
|
public Serializable deserializeResponse(String answer) throws TelegramApiRequestException {
|
||||||
try {
|
try {
|
||||||
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer,
|
||||||
new TypeReference<ApiResponse<Message>>(){});
|
new TypeReference<ApiResponse<Message>>(){});
|
||||||
@ -169,9 +170,20 @@ public class EditMessageText extends BotApiMethod<Message> {
|
|||||||
throw new TelegramApiRequestException("Error editing message text", result);
|
throw new TelegramApiRequestException("Error editing message text", result);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} 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);
|
throw new TelegramApiRequestException("Unable to deserialize response", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws TelegramApiValidationException {
|
public void validate() throws TelegramApiValidationException {
|
||||||
|
@ -164,21 +164,21 @@ public abstract class AbsSender {
|
|||||||
return sendApiMethod(getChatMemberCount);
|
return sendApiMethod(getChatMemberCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Message editMessageText(EditMessageText editMessageText) throws TelegramApiException {
|
public final Serializable editMessageText(EditMessageText editMessageText) throws TelegramApiException {
|
||||||
if (editMessageText == null) {
|
if (editMessageText == null) {
|
||||||
throw new TelegramApiException("Parameter editMessageText can not be null");
|
throw new TelegramApiException("Parameter editMessageText can not be null");
|
||||||
}
|
}
|
||||||
return sendApiMethod(editMessageText);
|
return sendApiMethod(editMessageText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Message editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException {
|
public final Serializable editMessageCaption(EditMessageCaption editMessageCaption) throws TelegramApiException {
|
||||||
if (editMessageCaption == null) {
|
if (editMessageCaption == null) {
|
||||||
throw new TelegramApiException("Parameter editMessageCaption can not be null");
|
throw new TelegramApiException("Parameter editMessageCaption can not be null");
|
||||||
}
|
}
|
||||||
return sendApiMethod(editMessageCaption);
|
return sendApiMethod(editMessageCaption);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Message editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException {
|
public final Serializable editMessageReplyMarkup(EditMessageReplyMarkup editMessageReplyMarkup) throws TelegramApiException {
|
||||||
if (editMessageReplyMarkup == null) {
|
if (editMessageReplyMarkup == null) {
|
||||||
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
|
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ public abstract class AbsSender {
|
|||||||
sendApiMethodAsync(getChatMemberCount, sentCallback);
|
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) {
|
if (editMessageText == null) {
|
||||||
throw new TelegramApiException("Parameter editMessageText can not be null");
|
throw new TelegramApiException("Parameter editMessageText can not be null");
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ public abstract class AbsSender {
|
|||||||
sendApiMethodAsync(editMessageText, sentCallback);
|
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) {
|
if (editMessageCaption == null) {
|
||||||
throw new TelegramApiException("Parameter editMessageCaption can not be null");
|
throw new TelegramApiException("Parameter editMessageCaption can not be null");
|
||||||
}
|
}
|
||||||
@ -429,7 +429,7 @@ public abstract class AbsSender {
|
|||||||
sendApiMethodAsync(editMessageCaption, sentCallback);
|
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) {
|
if (editMessageReplyMarkup == null) {
|
||||||
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
|
throw new TelegramApiException("Parameter editMessageReplyMarkup can not be null");
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.telegram</groupId>
|
<groupId>org.telegram</groupId>
|
||||||
<artifactId>telegrambots</artifactId>
|
<artifactId>telegrambots</artifactId>
|
||||||
<version>2.4.4.3</version>
|
<version>2.4.4.4</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Telegram Bots</name>
|
<name>Telegram Bots</name>
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<json.version>20160810</json.version>
|
<json.version>20160810</json.version>
|
||||||
<jackson.version>2.8.5</jackson.version>
|
<jackson.version>2.8.5</jackson.version>
|
||||||
<commonio.version>2.5</commonio.version>
|
<commonio.version>2.5</commonio.version>
|
||||||
<bots.version>2.4.4.3</bots.version>
|
<bots.version>2.4.4.4</bots.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
Loading…
Reference in New Issue
Block a user