Skip to content

Commit

Permalink
Merge pull request rubenlagus#291 from rubenlagus/dev
Browse files Browse the repository at this point in the history
Update API version 3.3
  • Loading branch information
rubenlagus authored Aug 23, 2017
2 parents c45e480 + 06c55a9 commit e2862be
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 121 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>3.2</version>
<version>3.3</version>
</dependency>
```

```gradle
compile "org.telegram:telegrambots:3.2"
compile "org.telegram:telegrambots:3.3"
```

2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/3.2)
3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v3.2)
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/3.3)
3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v3.3)

In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

Expand Down
135 changes: 69 additions & 66 deletions TelegramBots.wiki/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
### <a id="2.4.3"></a>2.4.3 ###
1. Split library in two modules to allow custom implementations.
2. Use [Guice](https://github.com/google/guice) for dependency injection.
3. Use [Jackson](https://github.com/FasterXML/jackson) for json (de)serialization.
4. Added extra validation to methods before performing requests.
5. BotOptions has been renamed ot DefaultBotOptions. It allows now to set number of threads for async methods execution and the complete `RequestConfig` for customization purpose.
6. Added convenient method for `setChatId` using just a `Long` value instead of an String.
7. In `SentCallback` method `onError` changed second parameter to `TelegramApiRequestException` and `onResult` now receives the deserialized answer (of type `T`) instead of a `JSONObject` as second parameter
8. Moved to MIT license
### <a id="3.2"></a>3.2 ###
1. Support for Api Version [3.3](https://core.telegram.org/bots/api-changelog#july-21-2017)

**[[How to update to version 2.4.3|How-To-Update#2.4.3]]**

### <a id="2.4.4"></a>2.4.4 ###
1. Added `cache_time` to ÀnswerCallbackQuery method
2. Added field `forward_from_message_id` to `Message` object
3. Renamed `ReplyKeyboardHide` to `ReplyKeyboardRemove` and its field `hide_keyboard` to `remove_keyboard`
4. Added field `force` and `disable_edit_message` to `SetGameScore`, removed `edit_message` one.
5. Added `channel_post` and `edited_channel_post` to `Update` object.
### <a id="3.2"></a>3.2 ###
1. Support for Api Version [3.2](https://core.telegram.org/bots/api-changelog#july-21-2017)
2. Deprecated all redundant methods in AbsSender, will be removed in next major release
3. New Abstract methods `addStickerToSet`, `createNewStickerSet` and `uploadStickerFile` in AbsSender.
4. Abilities module
5. Removed deprecated methods from previous versions
6. Bug fixing: #257, #270
7. Simplify code from DefaultAbsSender: #272

**[[How to update to version 2.4.4|How-To-Update#2.4.4]]**
**[[How to update to version 3.2|How-To-Update#3.2]]**

### <a id="2.4.4.1"></a>2.4.4.1 ###
1. New `max_connections` in `setWebhook` method.
2. New `allowed_updates` in `setWebhook` and `getUpdates`
3. New `deleteWebhook` method
4. Added new configs to DefaultBotOptions to handle `max_connections` and `allowed_updates`
### <a id="3.1.2"></a>3.1.2 ###
1. Fix bug #266

### <a id="2.4.4.3"></a>2.4.4.3 ###
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)
### <a id="3.1.1"></a>3.1.1 ###
1. Fix bug #264

**[[How to update to version 2.4.4.3|How-To-Update#2.4.4.3]]**
### <a id="3.1.0"></a>3.1.0 ###
1. Support for Api Version [3.1](https://core.telegram.org/bots/api-changelog#june-30-2017)
2. Simplified `DefaultAbsSender`
3. Added new abstract method `setChatPhoto` to AbsSender.
4. Added new method `execute` and `executeAsync` that can be used to send any api method that extends `BotApiMethod` class.
5. Added new constructors to `GetChat`, `GetChatAdministrators`, `GetChatMember`, `GetChatMemberCount`, `KickChatMember`, `LeaveChat` and `UnbanChatMember` with mandatory fields as parameters.

### <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 3.1.0|How-To-Update#3.1.0]]**

**[[How to update to version 2.4.4.4|How-To-Update#2.4.4.4]]**
### <a id="3.0.2"></a>3.0.2 ###
1. Bug Fixing: #250
2. Added new module `telegrambots-extensions` that should contains any extensions of the API such as CommandBot or TimedBot.
3. `TelegramLongPollingCommandBot` receives now the bot username as constructor parameters, all deprecated constructors will be removed in next major release.
4. `getUsername` method from `TelegramLongPollingCommandBot` can be considered `final` and will be so in next major release.

### <a id="2.4.4.5"></a>2.4.4.5 ###
1. New validations for AnswerInlineQuery according to Telegram Bots API changes.
2. Added Maven-enforcer-plugin to Maven pom.
3. Added new How to send photos by file_id to FAQ.
4. Added reference to new gitbook about this library.
5. Added custom ExponentialBackOff waiting time when having network problems in long-polling mode. (Custom implementation is allowed via BotOptions)
6. Bug fixing: #184, #183
**[[How to update to version 3.0.2|How-To-Update#3.0.2]]**

### <a id="3.0.1"></a>3.0.1 ###
1. Added `getLevel` to `BotLogger` class.
2. Fix wrong URL when setting webhook
3. Bug Fixing: #244, #233

### <a id="3.0"></a>3.0 ###
1. New field `gif_duration` and `mpeg4_duration` in `InlineQueryResultGif` and `InlineQueryResultMpeg4Gif`.
Expand All @@ -55,42 +52,48 @@

**[[How to update to version 3.0|How-To-Update#3.0]]**

### <a id="3.0.1"></a>3.0.1 ###
1. Added `getLevel` to `BotLogger` class.
2. Fix wrong URL when setting webhook
3. Bug Fixing: #244, #233
### <a id="2.4.4.5"></a>2.4.4.5 ###
1. New validations for AnswerInlineQuery according to Telegram Bots API changes.
2. Added Maven-enforcer-plugin to Maven pom.
3. Added new How to send photos by file_id to FAQ.
4. Added reference to new gitbook about this library.
5. Added custom ExponentialBackOff waiting time when having network problems in long-polling mode. (Custom implementation is allowed via BotOptions)
6. Bug fixing: #184, #183

### <a id="3.0.2"></a>3.0.2 ###
1. Bug Fixing: #250
2. Added new module `telegrambots-extensions` that should contains any extensions of the API such as CommandBot or TimedBot.
3. `TelegramLongPollingCommandBot` receives now the bot username as constructor parameters, all deprecated constructors will be removed in next major release.
4. `getUsername` method from `TelegramLongPollingCommandBot` can be considered `final` and will be so in next major release.
### <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 3.0.2|How-To-Update#3.0.2]]**
**[[How to update to version 2.4.4.4|How-To-Update#2.4.4.4]]**

### <a id="3.1.0"></a>3.1.0 ###
1. Support for Api Version [3.1](https://core.telegram.org/bots/api-changelog#june-30-2017)
2. Simplified `DefaultAbsSender`
3. Added new abstract method `setChatPhoto` to AbsSender.
4. Added new method `execute` and `executeAsync` that can be used to send any api method that extends `BotApiMethod` class.
5. Added new constructors to `GetChat`, `GetChatAdministrators`, `GetChatMember`, `GetChatMemberCount`, `KickChatMember`, `LeaveChat` and `UnbanChatMember` with mandatory fields as parameters.
### <a id="2.4.4.3"></a>2.4.4.3 ###
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 3.1.0|How-To-Update#3.1.0]]**
**[[How to update to version 2.4.4.3|How-To-Update#2.4.4.3]]**

### <a id="3.1.1"></a>3.1.1 ###
1. Fix bug #264
### <a id="2.4.4.1"></a>2.4.4.1 ###
1. New `max_connections` in `setWebhook` method.
2. New `allowed_updates` in `setWebhook` and `getUpdates`
3. New `deleteWebhook` method
4. Added new configs to DefaultBotOptions to handle `max_connections` and `allowed_updates`

### <a id="2.4.4"></a>2.4.4 ###
1. Added `cache_time` to ÀnswerCallbackQuery method
2. Added field `forward_from_message_id` to `Message` object
3. Renamed `ReplyKeyboardHide` to `ReplyKeyboardRemove` and its field `hide_keyboard` to `remove_keyboard`
4. Added field `force` and `disable_edit_message` to `SetGameScore`, removed `edit_message` one.
5. Added `channel_post` and `edited_channel_post` to `Update` object.

### <a id="3.1.2"></a>3.1.2 ###
1. Fix bug #266
**[[How to update to version 2.4.4|How-To-Update#2.4.4]]**

### <a id="3.2"></a>3.2 ###
1. Support for Api Version [3.2](https://core.telegram.org/bots/api-changelog#july-21-2017)
2. Deprecated all redundant methods in AbsSender, will be removed in next major release
3. New Abstract methods `addStickerToSet`, `createNewStickerSet` and `uploadStickerFile` in AbsSender.
4. Abilities module
5. Removed deprecated methods from previous versions
6. Bug fixing: #257, #270
7. Simplify code from DefaultAbsSender: #272
### <a id="2.4.3"></a>2.4.3 ###
1. Split library in two modules to allow custom implementations.
2. Use [Guice](https://github.com/google/guice) for dependency injection.
3. Use [Jackson](https://github.com/FasterXML/jackson) for json (de)serialization.
4. Added extra validation to methods before performing requests.
5. BotOptions has been renamed ot DefaultBotOptions. It allows now to set number of threads for async methods execution and the complete `RequestConfig` for customization purpose.
6. Added convenient method for `setChatId` using just a `Long` value instead of an String.
7. In `SentCallback` method `onError` changed second parameter to `TelegramApiRequestException` and `onResult` now receives the deserialized answer (of type `T`) instead of a `JSONObject` as second parameter
8. Moved to MIT license

**[[How to update to version 3.2|How-To-Update#3.2]]**
**[[How to update to version 2.4.3|How-To-Update#2.4.3]]**
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>3.2</version>
<version>3.3</version>
</dependency>
```
* With **Gradle**:

```groovy
compile group: 'org.telegram', name: 'telegrambots', version: '3.2'
compile group: 'org.telegram', name: 'telegrambots', version: '3.3'
```

2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
Expand Down
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>3.2</version>
<version>3.3</version>

<modules>
<module>telegrambots</module>
Expand All @@ -26,6 +26,6 @@

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<bots.version>3.2</bots.version>
<bots.version>3.3</bots.version>
</properties>
</project>
8 changes: 4 additions & 4 deletions telegrambots-abilities/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>3.2</version>
<version>3.3</version>
</dependency>
```

**Gradle**

```gradle
compile "org.telegram:telegrambots-abilities:3.2"
compile "org.telegram:telegrambots-abilities:3.3"
```

**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v3.2)
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v3.3)

**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v3.2)
**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v3.3)

Motivation
----------
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-abilities/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-abilities</artifactId>
<version>3.2</version>
<version>3.3</version>
<packaging>jar</packaging>

<name>Telegram Ability Bot</name>
Expand Down Expand Up @@ -65,7 +65,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>3.2</bots.version>
<bots.version>3.3</bots.version>
<commonslang.version>3.5</commonslang.version>
<mapdb.version>3.0.4</mapdb.version>
<guava.version>19.0</guava.version>
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId>
<version>3.2</version>
<version>3.3</version>
</dependency>
```

2. Using Gradle:

```gradle
compile "org.telegram:telegrambotsextensions:3.2"
compile "org.telegram:telegrambotsextensions:3.3"
```
4 changes: 2 additions & 2 deletions telegrambots-extensions/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>telegrambotsextensions</artifactId>
<version>3.2</version>
<version>3.3</version>
<packaging>jar</packaging>

<name>Telegram Bots Extensions</name>
Expand Down Expand Up @@ -59,7 +59,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>3.2</bots.version>
<bots.version>3.3</bots.version>
</properties>

<dependencies>
Expand Down
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>3.2</version>
<version>3.3</version>
<packaging>jar</packaging>

<name>Telegram Bots Meta</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Chat implements BotApiObject {
private static final String PHOTO_FIELD = "photo";
private static final String DESCRIPTION_FIELD = "description";
private static final String INVITELINK_FIELD = "invite_link";
private static final String PINNEDMESSAGE_FIELD = "pinned_message";

private static final String USERCHATTYPE = "private";
private static final String GROUPCHATTYPE = "group";
Expand Down Expand Up @@ -56,6 +57,8 @@ public class Chat implements BotApiObject {
private String description; ///< Optional. Description, for supergroups and channel chats. Returned only in getChat.
@JsonProperty(INVITELINK_FIELD)
private String inviteLink; ///< Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
@JsonProperty(PINNEDMESSAGE_FIELD)
private Message pinnedMessage; ///< Optional. Pinned message, for supergroups. Returned only in getChat.

public Chat() {
super();
Expand Down Expand Up @@ -113,6 +116,10 @@ public String getInviteLink() {
return inviteLink;
}

public Message getPinnedMessage() {
return pinnedMessage;
}

@Override
public String toString() {
return "Chat{" +
Expand All @@ -126,6 +133,7 @@ public String toString() {
", photo=" + photo +
", description='" + description + '\'' +
", inviteLink='" + inviteLink + '\'' +
", pinnedMessage=" + pinnedMessage +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class Message implements BotApiObject {
private static final String INVOICE_FIELD = "invoice";
private static final String SUCCESSFUL_PAYMENT_FIELD = "successful_payment";
private static final String VIDEO_NOTE_FIELD = "video_note";
private static final String AUTHORSIGNATURE_FIELD = "author_signature";
private static final String FORWARDSIGNATURE_FIELD = "forward_signature";

@JsonProperty(MESSAGEID_FIELD)
private Integer messageId; ///< Integer Unique message identifier
Expand Down Expand Up @@ -159,6 +161,11 @@ public class Message implements BotApiObject {
private SuccessfulPayment successfulPayment; ///< Optional. Message is a service message about a successful payment, information about the payment.
@JsonProperty(VIDEO_NOTE_FIELD)
private VideoNote videoNote; ///< Optional. Message is a video note, information about the video message
@JsonProperty(AUTHORSIGNATURE_FIELD)
private String authorSignature; ///< Optional. Post author signature for posts in channel chats
@JsonProperty(FORWARDSIGNATURE_FIELD)
private String forwardSignature; ///< Optional. Post author signature for messages forwarded from channel chats


public Message() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class User implements BotApiObject {

private static final String ID_FIELD = "id";
private static final String FIRSTNAME_FIELD = "first_name";
private static final String ISBOT_FIELD = "is_bot";
private static final String LASTNAME_FIELD = "last_name";
private static final String USERNAME_FIELD = "username";
private static final String LANGUAGECODE_FIELD = "language_code";
Expand All @@ -21,6 +22,8 @@ public class User implements BotApiObject {
private Integer id; ///< Unique identifier for this user or bot
@JsonProperty(FIRSTNAME_FIELD)
private String firstName; ///< User‘s or bot’s first name
@JsonProperty(ISBOT_FIELD)
private Boolean isBot; ///< True, if this user is a bot
@JsonProperty(LASTNAME_FIELD)
private String lastName; ///< Optional. User‘s or bot’s last name
@JsonProperty(USERNAME_FIELD)
Expand Down Expand Up @@ -52,11 +55,16 @@ public String getLanguageCode() {
return languageCode;
}

public Boolean getBot() {
return isBot;
}

@Override
public String toString() {
return "User{" +
"id=" + id +
", firstName='" + firstName + '\'' +
", isBot=" + isBot +
", lastName='" + lastName + '\'' +
", userName='" + userName + '\'' +
", languageCode='" + languageCode + '\'' +
Expand Down
Loading

0 comments on commit e2862be

Please sign in to comment.