Skip to content

Commit

Permalink
Merge pull request #188 from rubenlagus/dev
Browse files Browse the repository at this point in the history
Update 2.4.4.4
  • Loading branch information
rubenlagus authored Jan 15, 2017
2 parents 69b0002 + 75c3a48 commit b3828ac
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
7 changes: 6 additions & 1 deletion TelegramBots.wiki/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@
1. In `BotSession`, renamed `close` to `stop`. `Close` method is maintained for backward compatibility.
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]]**
4 changes: 2 additions & 2 deletions TelegramBots.wiki/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
6 changes: 5 additions & 1 deletion TelegramBots.wiki/How-To-Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
3. Removed deprecated stuff from version 2.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 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
2 changes: 1 addition & 1 deletion telegrambots-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
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";
Expand Down Expand Up @@ -104,7 +105,7 @@ public String getMethod() {
}

@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>>(){});
Expand All @@ -114,7 +115,18 @@ public Message deserializeResponse(String answer) throws TelegramApiRequestExcep
throw new TelegramApiRequestException("Error editing message caption", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", 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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@
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";
Expand Down Expand Up @@ -99,7 +101,7 @@ public String getMethod() {
}

@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>>(){});
Expand All @@ -109,7 +111,18 @@ public Message deserializeResponse(String answer) throws TelegramApiRequestExcep
throw new TelegramApiRequestException("Error editing message reply markup", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", 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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
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";
Expand Down Expand Up @@ -159,7 +160,7 @@ public String getMethod() {
}

@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>>(){});
Expand All @@ -169,7 +170,18 @@ public Message deserializeResponse(String answer) throws TelegramApiRequestExcep
throw new TelegramApiRequestException("Error editing message text", result);
}
} catch (IOException e) {
throw new TelegramApiRequestException("Unable to deserialize response", 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);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,21 @@ public final Integer getChatMemberCount(GetChatMemberCount getChatMemberCount) t
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");
}
Expand Down Expand Up @@ -407,7 +407,7 @@ public final void getChatMemberCountAsync(GetChatMemberCount getChatMemberCount,
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");
}
Expand All @@ -418,7 +418,7 @@ public final void editMessageTextAsync(EditMessageText editMessageText, SentCall
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");
}
Expand All @@ -429,7 +429,7 @@ public final void editMessageCaptionAsync(EditMessageCaption editMessageCaption,
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");
}
Expand Down
4 changes: 2 additions & 2 deletions telegrambots/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit b3828ac

Please sign in to comment.