Update version 4.1

This commit is contained in:
Ruben Bermudez 2018-08-21 20:59:55 +01:00
parent b0bc5ea5b7
commit 7f8df47f0b
20 changed files with 374 additions and 31 deletions

View File

@ -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>4.0.1</version>
<version>4.1</version>
</dependency>
```
```gradle
compile "org.telegram:telegrambots:4.0.1"
compile "org.telegram:telegrambots:4.1"
```
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.0.1)
3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.0.1)
2. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/4.1)
3. Download the jar(including all dependencies) from [here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.1)
In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

View File

@ -1,4 +1,7 @@
### <a id="4.0.0"></a>4.0.0 ###
### <a id="4.1"></a>4.1 ###
1. Support for Api Version [4.1](https://core.telegram.org/bots/api-changelog#august-22-2018)
### <a id="4.0.1"></a>4.0.1 ###
1. Fix bug #499
### <a id="4.0.0"></a>4.0.0 ###

View File

@ -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>4.0.1</version>
<version>4.1</version>
</dependency>
```
* With **Gradle**:
```groovy
compile group: 'org.telegram', name: 'telegrambots', version: '4.0.1'
compile group: 'org.telegram', name: 'telegrambots', version: '4.1'
```
2. Don't like **Maven Central Repository**? It can also be taken from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).

View File

@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```
* **Gradle**
```groovy
compile group: 'org.telegram', name: 'telegrambots-abilties', version: '4.0.1'
compile group: 'org.telegram', name: 'telegrambots-abilties', version: '4.1'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)

View File

@ -7,7 +7,7 @@
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<packaging>pom</packaging>
<version>4.0.1</version>
<version>4.1</version>
<modules>
<module>telegrambots</module>
@ -28,6 +28,6 @@
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
</properties>
</project>

View File

@ -18,19 +18,19 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```
**Gradle**
```gradle
compile "org.telegram:telegrambots-abilities:4.0.1"
compile "org.telegram:telegrambots-abilities:4.1"
```
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.0.1)
**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v4.1)
**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.0.1)
**Plain imports** - [Here](https://github.com/rubenlagus/TelegramBots/releases/tag/v4.1)
Motivation
----------

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Ability Bot</name>
@ -65,7 +65,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
<commonslang.version>3.5</commonslang.version>
<mapdb.version>3.0.4</mapdb.version>
<guava.version>19.0</guava.version>

View File

@ -15,7 +15,7 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Bots Chat Session Bot</name>
@ -65,7 +65,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
<shiro.version>1.4.0</shiro.version>
</properties>

View File

@ -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>4.0.1</version>
<version>4.1</version>
</dependency>
```
2. Using Gradle:
```gradle
compile "org.telegram:telegrambotsextensions:4.0.1"
compile "org.telegram:telegrambotsextensions:4.1"
```

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Bots Extensions</name>
@ -59,7 +59,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
</properties>
<dependencies>

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-meta</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Bots Meta</name>

View File

@ -3,6 +3,7 @@ package org.telegram.telegrambots.meta.api.objects.passport;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
import java.util.ArrayList;
import java.util.List;
/**
@ -20,6 +21,8 @@ public class EncryptedPassportElement implements BotApiObject {
private static final String FRONTSIDE_FIELD = "front_side";
private static final String REVERSESIDE_FIELD = "reverse_side";
private static final String SELFIE_FIELD = "selfie";
private static final String TRANSLATION_FIELD = "translation";
private static final String HASH_FIELD = "hash";
/**
* Data type. One of personal_details, passport, driver_license, identity_card, internal_passport,
@ -68,6 +71,19 @@ public class EncryptedPassportElement implements BotApiObject {
*/
@JsonProperty(SELFIE_FIELD)
private PassportFile selfie;
/**
* Optional. Array of encrypted files with translated versions of documents provided by the user.
* Available if requested for passport, driver_license, identity_card, internal_passport,
* utility_bill, bank_statement, rental_agreement, passport_registration and temporary_registration types.
* Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
@JsonProperty(TRANSLATION_FIELD)
private ArrayList<PassportFile> translations;
/**
* Base64-encoded element hash for using in PassportElementErrorUnspecified
*/
@JsonProperty(HASH_FIELD)
private String hash;
public EncryptedPassportElement(String type, String data, String phoneNumber, String email, List<PassportFile> files,
PassportFile frontSide, PassportFile reverseSide, PassportFile selfie) {
@ -116,6 +132,18 @@ public class EncryptedPassportElement implements BotApiObject {
return selfie;
}
public String getHash() {
return hash;
}
public boolean hasTranslations() {
return translations != null && !translations.isEmpty();
}
public ArrayList<PassportFile> getTranslations() {
return translations;
}
@Override
public String toString() {
return "EncryptedPassportElement{" +
@ -127,6 +155,8 @@ public class EncryptedPassportElement implements BotApiObject {
", frontSide=" + frontSide +
", reverseSide=" + reverseSide +
", selfie=" + selfie +
", translations=" + translations +
", hash='" + hash + '\'' +
'}';
}
}

View File

@ -15,6 +15,9 @@ import org.telegram.telegrambots.meta.api.interfaces.Validable;
* PassportElementErrorSelfie
* PassportElementErrorFile
* PassportElementErrorFiles
* PassportElementErrorUnspecified
* PassportElementErrorTranslationFile
* PassportElementErrorTranslationFiles
*/
public interface PassportElementError extends InputBotApiObject, Validable {
}

View File

@ -0,0 +1,99 @@
package org.telegram.telegrambots.meta.api.objects.passport.dataerror;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 4.1
*
* Represents an issue with one of the files that constitute the translation of a document.
* The error is considered resolved when the file changes.
*/
public class PassportElementErrorTranslationFile implements PassportElementError {
private static final String SOURCE_FIELD = "source";
private static final String TYPE_FIELD = "type";
private static final String FILEHASH_FIELD = "file_hash";
private static final String MESSAGE_FIELD = "message";
@JsonProperty(SOURCE_FIELD)
private final String source = "translation_file"; ///< Error source, must be translation_file
/**
* Type of element of the user's Telegram Passport which has the issue, one of passport, driver_license,
* identity_card, internal_passport, utility_bill, bank_statement, rental_agreement,
* passport_registration, temporary_registration
*/
@JsonProperty(TYPE_FIELD)
private String type;
@JsonProperty(FILEHASH_FIELD)
private String fileHash; ///< Base64-encoded file hash
@JsonProperty(MESSAGE_FIELD)
private String message; ///< Error message
public PassportElementErrorTranslationFile() {
super();
}
public PassportElementErrorTranslationFile(String type, String fileHash, String message) {
super();
this.type = checkNotNull(type);
this.fileHash = checkNotNull(fileHash);
this.message = checkNotNull(message);
}
public String getType() {
return type;
}
public PassportElementErrorTranslationFile setType(String type) {
this.type = checkNotNull(type);
return this;
}
public String getSource() {
return source;
}
public String getFileHash() {
return fileHash;
}
public PassportElementErrorTranslationFile setFileHash(String fileHash) {
this.fileHash = fileHash;
return this;
}
public String getMessage() {
return message;
}
public PassportElementErrorTranslationFile setMessage(String message) {
this.message = checkNotNull(message);
return this;
}
@Override
public void validate() throws TelegramApiValidationException {
if (fileHash == null || fileHash.isEmpty()) {
throw new TelegramApiValidationException("File hash parameter can't be empty", this);
}
if (message == null || message.isEmpty()) {
throw new TelegramApiValidationException("Message parameter can't be empty", this);
}
if (type == null || type.isEmpty()) {
throw new TelegramApiValidationException("Type parameter can't be empty", this);
}
}
@Override
public String toString() {
return "PassportElementErrorTranslationFile{" +
"source='" + source + '\'' +
", type='" + type + '\'' +
", fileHash='" + fileHash + '\'' +
", message='" + message + '\'' +
'}';
}
}

View File

@ -0,0 +1,111 @@
package org.telegram.telegrambots.meta.api.objects.passport.dataerror;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 4.1
*
* Represents an issue with the translated version of a document.
* The error is considered resolved when a file with the document translation change.
*/
public class PassportElementErrorTranslationFiles implements PassportElementError {
private static final String SOURCE_FIELD = "source";
private static final String TYPE_FIELD = "type";
private static final String FILEHASHES_FIELD = "file_hashes";
private static final String MESSAGE_FIELD = "message";
@JsonProperty(SOURCE_FIELD)
private final String source = "translation_files"; ///< Error source, must be translation_files
/**
* Type of element of the user's Telegram Passport which has the issue, one of passport, driver_license,
* identity_card, internal_passport, utility_bill, bank_statement, rental_agreement,
* passport_registration, temporary_registration
*/
@JsonProperty(TYPE_FIELD)
private String type;
@JsonProperty(FILEHASHES_FIELD)
private List<String> fileHashes; ///< List of base64-encoded file hashes
@JsonProperty(MESSAGE_FIELD)
private String message; ///< Error message
public PassportElementErrorTranslationFiles() {
super();
}
public PassportElementErrorTranslationFiles(String type, List<String> fileHashes, String message) {
super();
this.type = checkNotNull(type);
this.fileHashes = checkNotNull(fileHashes);
this.message = checkNotNull(message);
}
public String getType() {
return type;
}
public PassportElementErrorTranslationFiles setType(String type) {
this.type = checkNotNull(type);
return this;
}
public String getSource() {
return source;
}
public List<String> getFileHashes() {
return fileHashes;
}
public PassportElementErrorTranslationFiles setFileHashes(List<String> fileHashes) {
this.fileHashes = checkNotNull(fileHashes);
return this;
}
public PassportElementErrorTranslationFiles addFileHash(String fileHash) {
fileHash = checkNotNull(fileHash);
if (fileHashes == null) {
fileHashes = new ArrayList<>();
}
fileHashes.add(fileHash);
return this;
}
public String getMessage() {
return message;
}
public PassportElementErrorTranslationFiles setMessage(String message) {
this.message = checkNotNull(message);
return this;
}
@Override
public void validate() throws TelegramApiValidationException {
if (fileHashes == null || fileHashes.isEmpty()) {
throw new TelegramApiValidationException("File hash parameter can't be empty", this);
}
if (message == null || message.isEmpty()) {
throw new TelegramApiValidationException("Message parameter can't be empty", this);
}
if (type == null || type.isEmpty()) {
throw new TelegramApiValidationException("Type parameter can't be empty", this);
}
}
@Override
public String toString() {
return "PassportElementErrorTranslationFiles{" +
"source='" + source + '\'' +
", type='" + type + '\'' +
", fileHashes=" + fileHashes +
", message='" + message + '\'' +
'}';
}
}

View File

@ -0,0 +1,97 @@
package org.telegram.telegrambots.meta.api.objects.passport.dataerror;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* @author Ruben Bermudez
* @version 4.1
*
* Represents an issue in an unspecified place.
* The error is considered resolved when new data is added.
*/
public class PassportElementErrorUnspecified implements PassportElementError {
private static final String SOURCE_FIELD = "source";
private static final String TYPE_FIELD = "type";
private static final String ELEMENTHASH_FIELD = "element_hash";
private static final String MESSAGE_FIELD = "message";
@JsonProperty(SOURCE_FIELD)
private final String source = "unspecified"; ///< Error source, must be unspecified
/**
* Type of element of the user's Telegram Passport which has the issue
*/
@JsonProperty(TYPE_FIELD)
private String type;
@JsonProperty(ELEMENTHASH_FIELD)
private String elementHash; ///< Base64-encoded element hash
@JsonProperty(MESSAGE_FIELD)
private String message; ///< Error message
public PassportElementErrorUnspecified() {
super();
}
public PassportElementErrorUnspecified(String type, String elementHash, String message) {
super();
this.type = checkNotNull(type);
this.elementHash = checkNotNull(elementHash);
this.message = checkNotNull(message);
}
public String getType() {
return type;
}
public PassportElementErrorUnspecified setType(String type) {
this.type = checkNotNull(type);
return this;
}
public String getSource() {
return source;
}
public String getElementHash() {
return elementHash;
}
public PassportElementErrorUnspecified setElementHash(String elementHash) {
this.elementHash = elementHash;
return this;
}
public String getMessage() {
return message;
}
public PassportElementErrorUnspecified setMessage(String message) {
this.message = checkNotNull(message);
return this;
}
@Override
public void validate() throws TelegramApiValidationException {
if (elementHash == null || elementHash.isEmpty()) {
throw new TelegramApiValidationException("Element hash parameter can't be empty", this);
}
if (message == null || message.isEmpty()) {
throw new TelegramApiValidationException("Message parameter can't be empty", this);
}
if (type == null || type.isEmpty()) {
throw new TelegramApiValidationException("Type parameter can't be empty", this);
}
}
@Override
public String toString() {
return "PassportElementErrorFile{" +
"source='" + source + '\'' +
", type='" + type + '\'' +
", elementHash='" + elementHash + '\'' +
", message='" + message + '\'' +
'}';
}
}

View File

@ -18,14 +18,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-spring-boot-starter</artifactId>
<version>4.0.1</version>
<version>4.1</version>
</dependency>
```
**Gradle**
```gradle
compile "org.telegram:telegrambots-spring-boot-starter:4.0.1"
compile "org.telegram:telegrambots-spring-boot-starter:4.1"
```
Motivation

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-spring-boot-starter</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Bots Spring Boot Starter</name>
@ -59,7 +59,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
<spring-boot.version>2.0.2.RELEASE</spring-boot.version>
</properties>

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<packaging>jar</packaging>
<name>Telegram Bots</name>
@ -66,7 +66,7 @@
<jackson.version>2.8.7</jackson.version>
<jacksonanotation.version>2.8.0</jacksonanotation.version>
<commonio.version>2.5</commonio.version>
<bots.version>4.0.1</bots.version>
<bots.version>4.1</bots.version>
</properties>
<dependencyManagement>