diff --git a/README.md b/README.md
index cefd23dd..f7a862cd 100644
--- a/README.md
+++ b/README.md
@@ -27,16 +27,16 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambots
- 4.0.1
+ 4.1
```
```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`.
diff --git a/TelegramBots.wiki/Changelog.md b/TelegramBots.wiki/Changelog.md
index ab73da5a..8c0b1392 100644
--- a/TelegramBots.wiki/Changelog.md
+++ b/TelegramBots.wiki/Changelog.md
@@ -1,4 +1,7 @@
-### 4.0.0 ###
+### 4.1 ###
+1. Support for Api Version [4.1](https://core.telegram.org/bots/api-changelog#august-22-2018)
+
+### 4.0.1 ###
1. Fix bug #499
### 4.0.0 ###
diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md
index effe0c34..2bea5d5d 100644
--- a/TelegramBots.wiki/Getting-Started.md
+++ b/TelegramBots.wiki/Getting-Started.md
@@ -11,13 +11,13 @@ First you need ot get the library and add it to your project. There are few poss
org.telegram
telegrambots
- 4.0.1
+ 4.1
```
* 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).
diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md
index 50df2521..a05dddc6 100644
--- a/TelegramBots.wiki/abilities/Simple-Example.md
+++ b/TelegramBots.wiki/abilities/Simple-Example.md
@@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
org.telegram
telegrambots-abilities
- 4.0.1
+ 4.1
```
* **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)
diff --git a/pom.xml b/pom.xml
index 73824b21..b6176008 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.telegram
Bots
pom
- 4.0.1
+ 4.1
telegrambots
@@ -28,6 +28,6 @@
true
- 4.0.1
+ 4.1
\ No newline at end of file
diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md
index c48783d6..22f0dbd7 100644
--- a/telegrambots-abilities/README.md
+++ b/telegrambots-abilities/README.md
@@ -18,19 +18,19 @@ Usage
org.telegram
telegrambots-abilities
- 4.0.1
+ 4.1
```
**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
----------
diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml
index b6b786bc..16ebe0f3 100644
--- a/telegrambots-abilities/pom.xml
+++ b/telegrambots-abilities/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-abilities
- 4.0.1
+ 4.1
jar
Telegram Ability Bot
@@ -65,7 +65,7 @@
UTF-8
UTF-8
- 4.0.1
+ 4.1
3.5
3.0.4
19.0
diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md
index f43e4428..bbb7ec45 100644
--- a/telegrambots-chat-session-bot/README.md
+++ b/telegrambots-chat-session-bot/README.md
@@ -15,7 +15,7 @@ Usage
org.telegram
telegrambots-chat-session-bot
- 4.0.1
+ 4.1
```
diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml
index 954607f8..3ce170a9 100644
--- a/telegrambots-chat-session-bot/pom.xml
+++ b/telegrambots-chat-session-bot/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-chat-session-bot
- 4.0.1
+ 4.1
jar
Telegram Bots Chat Session Bot
@@ -65,7 +65,7 @@
UTF-8
UTF-8
- 4.0.1
+ 4.1
1.4.0
diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md
index 7edc5b7e..02984f67 100644
--- a/telegrambots-extensions/README.md
+++ b/telegrambots-extensions/README.md
@@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
org.telegram
telegrambotsextensions
- 4.0.1
+ 4.1
```
2. Using Gradle:
```gradle
- compile "org.telegram:telegrambotsextensions:4.0.1"
+ compile "org.telegram:telegrambotsextensions:4.1"
```
\ No newline at end of file
diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml
index a5ea6a36..ed11f08b 100644
--- a/telegrambots-extensions/pom.xml
+++ b/telegrambots-extensions/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambotsextensions
- 4.0.1
+ 4.1
jar
Telegram Bots Extensions
@@ -59,7 +59,7 @@
UTF-8
UTF-8
- 4.0.1
+ 4.1
diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml
index 45f925f8..88dd8d92 100644
--- a/telegrambots-meta/pom.xml
+++ b/telegrambots-meta/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-meta
- 4.0.1
+ 4.1
jar
Telegram Bots Meta
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/EncryptedPassportElement.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/EncryptedPassportElement.java
index 5e2b2f7d..25bcab65 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/EncryptedPassportElement.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/EncryptedPassportElement.java
@@ -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 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 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 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 + '\'' +
'}';
}
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementError.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementError.java
index aa3a66fc..554e3209 100644
--- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementError.java
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementError.java
@@ -15,6 +15,9 @@ import org.telegram.telegrambots.meta.api.interfaces.Validable;
* PassportElementErrorSelfie
* PassportElementErrorFile
* PassportElementErrorFiles
+ * PassportElementErrorUnspecified
+ * PassportElementErrorTranslationFile
+ * PassportElementErrorTranslationFiles
*/
public interface PassportElementError extends InputBotApiObject, Validable {
}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorTranslationFile.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorTranslationFile.java
new file mode 100644
index 00000000..5581d79a
--- /dev/null
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorTranslationFile.java
@@ -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 + '\'' +
+ '}';
+ }
+}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorTranslationFiles.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorTranslationFiles.java
new file mode 100644
index 00000000..9579a3a0
--- /dev/null
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorTranslationFiles.java
@@ -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 fileHashes; ///< List of base64-encoded file hashes
+ @JsonProperty(MESSAGE_FIELD)
+ private String message; ///< Error message
+
+ public PassportElementErrorTranslationFiles() {
+ super();
+ }
+
+ public PassportElementErrorTranslationFiles(String type, List 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 getFileHashes() {
+ return fileHashes;
+ }
+
+ public PassportElementErrorTranslationFiles setFileHashes(List 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 + '\'' +
+ '}';
+ }
+}
diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorUnspecified.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorUnspecified.java
new file mode 100644
index 00000000..e49efcfb
--- /dev/null
+++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/passport/dataerror/PassportElementErrorUnspecified.java
@@ -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 + '\'' +
+ '}';
+ }
+}
diff --git a/telegrambots-spring-boot-starter/README.md b/telegrambots-spring-boot-starter/README.md
index a20ed49e..42d4b151 100644
--- a/telegrambots-spring-boot-starter/README.md
+++ b/telegrambots-spring-boot-starter/README.md
@@ -18,14 +18,14 @@ Usage
org.telegram
telegrambots-spring-boot-starter
- 4.0.1
+ 4.1
```
**Gradle**
```gradle
- compile "org.telegram:telegrambots-spring-boot-starter:4.0.1"
+ compile "org.telegram:telegrambots-spring-boot-starter:4.1"
```
Motivation
diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml
index ac0bb53b..d4060688 100644
--- a/telegrambots-spring-boot-starter/pom.xml
+++ b/telegrambots-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots-spring-boot-starter
- 4.0.1
+ 4.1
jar
Telegram Bots Spring Boot Starter
@@ -59,7 +59,7 @@
UTF-8
UTF-8
- 4.0.1
+ 4.1
2.0.2.RELEASE
diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml
index 1f57dab8..baba488b 100644
--- a/telegrambots/pom.xml
+++ b/telegrambots/pom.xml
@@ -5,7 +5,7 @@
4.0.0
org.telegram
telegrambots
- 4.0.1
+ 4.1
jar
Telegram Bots
@@ -66,7 +66,7 @@
2.8.7
2.8.0
2.5
- 4.0.1
+ 4.1