From feffffe112dcf64b42e23ec6b49e07ab9b103bf7 Mon Sep 17 00:00:00 2001 From: Ruben Date: Sat, 1 Jan 2022 23:06:28 +0000 Subject: [PATCH] Api Version 5.6 --- README.md | 8 ++--- TelegramBots.wiki/Changelog.md | 5 ++- TelegramBots.wiki/Getting-Started.md | 4 +-- TelegramBots.wiki/abilities/Simple-Example.md | 4 +-- pom.xml | 2 +- telegrambots-abilities/README.md | 4 +-- telegrambots-abilities/pom.xml | 4 +-- telegrambots-chat-session-bot/README.md | 4 +-- telegrambots-chat-session-bot/pom.xml | 4 +-- telegrambots-extensions/README.md | 4 +-- telegrambots-extensions/pom.xml | 4 +-- telegrambots-meta/pom.xml | 2 +- .../meta/api/methods/CopyMessage.java | 3 ++ .../meta/api/methods/ForwardMessage.java | 3 ++ .../meta/api/methods/polls/SendPoll.java | 3 ++ .../meta/api/methods/send/SendAnimation.java | 3 ++ .../meta/api/methods/send/SendAudio.java | 3 ++ .../meta/api/methods/send/SendContact.java | 3 ++ .../meta/api/methods/send/SendDice.java | 3 ++ .../meta/api/methods/send/SendDocument.java | 3 ++ .../meta/api/methods/send/SendGame.java | 3 ++ .../meta/api/methods/send/SendInvoice.java | 3 ++ .../meta/api/methods/send/SendLocation.java | 3 ++ .../meta/api/methods/send/SendMediaGroup.java | 2 ++ .../meta/api/methods/send/SendMessage.java | 3 ++ .../meta/api/methods/send/SendPhoto.java | 3 ++ .../meta/api/methods/send/SendSticker.java | 2 ++ .../meta/api/methods/send/SendVenue.java | 3 ++ .../meta/api/methods/send/SendVideo.java | 3 ++ .../meta/api/methods/send/SendVideoNote.java | 3 ++ .../meta/api/methods/send/SendVoice.java | 3 ++ .../meta/api/objects/EntityType.java | 1 + .../meta/api/objects/MessageEntity.java | 35 ++++++++++--------- .../meta/api/objects/media/InputMedia.java | 8 ++--- .../serialization/InputMediaSerializer.java | 6 ++-- telegrambots-spring-boot-starter/README.md | 4 +-- telegrambots-spring-boot-starter/pom.xml | 4 +-- telegrambots/pom.xml | 4 +-- .../telegrambots/bots/DefaultAbsSender.java | 27 ++++++++++++++ 39 files changed, 140 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index d2e03cd0..ece85637 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,18 @@ Just import add the library to your project with one of these options: org.telegram telegrambots - 5.5.0 + 5.6.0 ``` 2. Using Gradle: ```gradle - implementation 'org.telegram:telegrambots:5.5.0' + implementation 'org.telegram:telegrambots:5.6.0' ``` - 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.5.0) - 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.5.0) + 3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/5.6.0) + 4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/5.6.0) 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 0546aa32..707ca82e 100644 --- a/TelegramBots.wiki/Changelog.md +++ b/TelegramBots.wiki/Changelog.md @@ -1,5 +1,8 @@ +### 5.6.0 ### +1. Update Api version [5.6](https://core.telegram.org/bots/api-changelog#december-30-2021) + ### 5.5.0 ### -1. Update Api version [5.5](https://core.telegram.org/bots/api#december-7-2021) +1. Update Api version [5.5](https://core.telegram.org/bots/api-changelog#december-7-2021) ### 5.4.0.1 ### 1. Bug fixing: #999, #1000 diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md index f49f51b9..d7197a55 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 - 5.5.0 + 5.6.0 ``` * With **Gradle**: ```gradle - implementation 'org.telegram:telegrambots:5.5.0' + implementation 'org.telegram:telegrambots:5.6.0' ``` 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 31f8f126..41ae3175 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 - 5.5.0 + 5.6.0 ``` * **Gradle** ```gradle - implementation 'org.telegram:telegrambots-abilities:5.5.0' + implementation 'org.telegram:telegrambots-abilities:5.6.0' ``` * [JitPack](https://jitpack.io/#rubenlagus/TelegramBots) diff --git a/pom.xml b/pom.xml index 0e4a4a11..7266be70 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots pom - 5.5.0 + 5.6.0 telegrambots diff --git a/telegrambots-abilities/README.md b/telegrambots-abilities/README.md index 24f7af49..b32575c8 100644 --- a/telegrambots-abilities/README.md +++ b/telegrambots-abilities/README.md @@ -18,14 +18,14 @@ Usage org.telegram telegrambots-abilities - 5.5.0 + 5.6.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-abilities:5.5.0' + implementation 'org.telegram:telegrambots-abilities:5.6.0' ``` **JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1) diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml index 9a4a3255..3583ca1a 100644 --- a/telegrambots-abilities/pom.xml +++ b/telegrambots-abilities/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.5.0 + 5.6.0 telegrambots-abilities @@ -84,7 +84,7 @@ org.telegram telegrambots - 5.5.0 + 5.6.0 org.apache.commons diff --git a/telegrambots-chat-session-bot/README.md b/telegrambots-chat-session-bot/README.md index cf7cbc6c..b958abdb 100644 --- a/telegrambots-chat-session-bot/README.md +++ b/telegrambots-chat-session-bot/README.md @@ -15,14 +15,14 @@ Usage org.telegram telegrambots-chat-session-bot - 5.5.0 + 5.6.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-chat-session-bot:5.5.0' + implementation 'org.telegram:telegrambots-chat-session-bot:5.6.0' ``` Motivation diff --git a/telegrambots-chat-session-bot/pom.xml b/telegrambots-chat-session-bot/pom.xml index 696e1437..9d71f0d2 100644 --- a/telegrambots-chat-session-bot/pom.xml +++ b/telegrambots-chat-session-bot/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.5.0 + 5.6.0 telegrambots-chat-session-bot @@ -84,7 +84,7 @@ org.telegram telegrambots - 5.5.0 + 5.6.0 diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md index 9dc231be..addb5b6c 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 - 5.5.0 + 5.6.0 ``` 2. Using Gradle: ```gradle - implementation 'org.telegram:telegrambotsextensions:5.5.0' + implementation 'org.telegram:telegrambotsextensions:5.6.0' ``` \ No newline at end of file diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml index 52c88453..c5e653a2 100644 --- a/telegrambots-extensions/pom.xml +++ b/telegrambots-extensions/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.5.0 + 5.6.0 telegrambotsextensions @@ -75,7 +75,7 @@ org.telegram telegrambots - 5.5.0 + 5.6.0 diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml index 40f67730..d7f60a5b 100644 --- a/telegrambots-meta/pom.xml +++ b/telegrambots-meta/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.5.0 + 5.6.0 telegrambots-meta diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java index f5898f6a..84dad6d6 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/CopyMessage.java @@ -53,6 +53,7 @@ public class CopyMessage extends BotApiMethod { private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; private static final String REPLYMARKUP_FIELD = "reply_markup"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -85,6 +86,8 @@ public class CopyMessage extends BotApiMethod { @JsonProperty(REPLYMARKUP_FIELD) @JsonDeserialize() private ReplyKeyboard replyMarkup; + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = null; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java index a43f72fe..78b17932 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ForwardMessage.java @@ -41,6 +41,7 @@ public class ForwardMessage extends BotApiMethod { private static final String FROMCHATID_FIELD = "from_chat_id"; private static final String MESSAGEID_FIELD = "message_id"; private static final String DISABLENOTIFICATION_FIELD = "disable_notification"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -59,6 +60,8 @@ public class ForwardMessage extends BotApiMethod { */ @JsonProperty(DISABLENOTIFICATION_FIELD) private Boolean disableNotification; + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving @Override public void validate() throws TelegramApiValidationException { diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java index e48cb442..080c8257 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/polls/SendPoll.java @@ -60,6 +60,7 @@ public class SendPoll extends BotApiMethod { private static final String EXPLANATIONPARSEMODE_FIELD = "explanation_parse_mode"; private static final String EXPLANATION_ENTITIES_FIELD = "explanation_entities"; private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; /** * Unique identifier for the target chat or username of the target channel (in the format @channelusername). @@ -105,6 +106,8 @@ public class SendPoll extends BotApiMethod { private List explanationEntities; ///< Optional. List of special entities that appear in the poll explanation, which can be specified instead of parse_mode @JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD) private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = null; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java index 2e078eaa..d30fb62c 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java @@ -1,5 +1,6 @@ package org.telegram.telegrambots.meta.api.methods.send; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import lombok.AllArgsConstructor; import lombok.Builder; @@ -55,6 +56,7 @@ public class SendAnimation extends PartialBotApiMethod { public static final String THUMB_FIELD = "thumb"; public static final String CAPTION_ENTITIES_FIELD = "caption_entities"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) @@ -85,6 +87,7 @@ public class SendAnimation extends PartialBotApiMethod { @Singular private List captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java index 1cc8fd0a..eed92725 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java @@ -1,5 +1,6 @@ package org.telegram.telegrambots.meta.api.methods.send; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import lombok.AllArgsConstructor; import lombok.Builder; @@ -56,6 +57,7 @@ public class SendAudio extends PartialBotApiMethod { public static final String THUMB_FIELD = "thumb"; public static final String CAPTION_ENTITIES_FIELD = "caption_entities"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (or Username fro channels) @@ -81,6 +83,7 @@ public class SendAudio extends PartialBotApiMethod { @Singular private List captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java index 352672ee..502f51a6 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendContact.java @@ -46,6 +46,7 @@ public class SendContact extends BotApiMethod { private static final String REPLYMARKUP_FIELD = "reply_markup"; private static final String VCARD_FIELD = "vcard"; private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -68,6 +69,8 @@ public class SendContact extends BotApiMethod { private String vCard; ///< Optional. Additional data about the contact in the form of a vCard @JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD) private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java index 967a08be..afc12f57 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDice.java @@ -47,6 +47,7 @@ public class SendDice extends BotApiMethod { private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; private static final String REPLYMARKUP_FIELD = "reply_markup"; private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -72,6 +73,8 @@ public class SendDice extends BotApiMethod { private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard @JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD) private Boolean allowSendingWithoutReply; ///< Optional. Pass True, if the message should be sent even if the specified replied-to message is not found + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java index 77c8c135..57cd3c1e 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java @@ -1,5 +1,6 @@ package org.telegram.telegrambots.meta.api.methods.send; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import lombok.AllArgsConstructor; import lombok.Builder; @@ -50,6 +51,7 @@ public class SendDocument extends PartialBotApiMethod { public static final String CAPTION_ENTITIES_FIELD = "caption_entities"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; public static final String DISABLECONTENTTYPEDETECTION_FIELD = "disable_content_type_detection"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat to send the message to or Username for the channel to send the message to @@ -73,6 +75,7 @@ public class SendDocument extends PartialBotApiMethod { private List captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found private Boolean disableContentTypeDetection; ///< Optional Disables automatic server-side content type detection for files uploaded using multipart/form-data + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java index 08dce18c..6309b613 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendGame.java @@ -59,6 +59,7 @@ public class SendGame extends BotApiMethod { private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; private static final String REPLYMARKUP_FIELD = "reply_markup"; private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -74,6 +75,8 @@ public class SendGame extends BotApiMethod { private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard @JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD) private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = null; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java index 66520450..01cc934b 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendInvoice.java @@ -66,6 +66,7 @@ public class SendInvoice extends BotApiMethod { private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; private static final String MAXTIPAMOUNT_FIELD = "max_tip_amount"; private static final String SUGGESTEDTIPAMOUNTS_FIELD = "suggested_tip_amounts"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -161,6 +162,8 @@ public class SendInvoice extends BotApiMethod { @JsonProperty(SUGGESTEDTIPAMOUNTS_FIELD) @Singular private List suggestedTipAmounts; + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving @Override public String getMethod() { diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java index e00372c2..f90ed627 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendLocation.java @@ -47,6 +47,7 @@ public class SendLocation extends BotApiMethod { private static final String HORIZONTALACCURACY_FIELD = "horizontal_accuracy"; private static final String HEADING_FIELD = "heading"; private static final String PROXIMITYALERTRADIUS_FIELD = "proximity_alert_radius"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -87,6 +88,8 @@ public class SendLocation extends BotApiMethod { */ @JsonProperty(PROXIMITYALERTRADIUS_FIELD) private Integer proximityAlertRadius; + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java index 4720efd6..118fb854 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java @@ -50,6 +50,7 @@ public class SendMediaGroup extends PartialBotApiMethod> { public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -63,6 +64,7 @@ public class SendMediaGroup extends PartialBotApiMethod> { private Boolean disableNotification; ///< Optional. Sends the messages silently. Users will receive a notification with no sound. @JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD) private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java index b9cfda50..f3d02da9 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java @@ -50,6 +50,7 @@ public class SendMessage extends BotApiMethod { private static final String REPLYMARKUP_FIELD = "reply_markup"; private static final String ENTITIES_FIELD = "entities"; private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -72,6 +73,8 @@ public class SendMessage extends BotApiMethod { private List entities; ///< Optional. List of special entities that appear in message text, which can be specified instead of parse_mode @JsonProperty(ALLOWSENDINGWITHOUTREPLY_FIELD) private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void disableWebPagePreview() { disableWebPagePreview = true; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java index 3dd4a91f..6c04aa49 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java @@ -1,5 +1,6 @@ package org.telegram.telegrambots.meta.api.methods.send; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import lombok.AllArgsConstructor; import lombok.Builder; @@ -49,6 +50,7 @@ public class SendPhoto extends PartialBotApiMethod { public static final String PARSEMODE_FIELD = "parse_mode"; public static final String CAPTION_ENTITIES_FIELD = "caption_entities"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) @@ -62,6 +64,7 @@ public class SendPhoto extends PartialBotApiMethod { @Singular private List captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java index 591517ff..a9e692f9 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java @@ -42,6 +42,7 @@ public class SendSticker extends PartialBotApiMethod { public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; public static final String REPLYMARKUP_FIELD = "reply_markup"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) @@ -51,6 +52,7 @@ public class SendSticker extends PartialBotApiMethod { private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public Boolean getDisableNotification() { return disableNotification; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java index 61711a78..0cce42f3 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVenue.java @@ -50,6 +50,7 @@ public class SendVenue extends BotApiMethod { private static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; private static final String GOOGLEPLACEID_FIELD = "google_place_id"; private static final String GOOGLEPLACETYPE_FIELD = "google_place_type"; + private static final String PROTECTCONTENT_FIELD = "protect_content"; @JsonProperty(CHATID_FIELD) @NonNull @@ -82,6 +83,8 @@ public class SendVenue extends BotApiMethod { private String googlePlaceId; ///< Optional. Google Places identifier of the venue @JsonProperty(GOOGLEPLACETYPE_FIELD) private String googlePlaceType; ///< Optional. Google Places type of the venue. (See supported types.) + @JsonProperty(PROTECTCONTENT_FIELD) + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java index abc90b05..212af2bb 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java @@ -1,5 +1,6 @@ package org.telegram.telegrambots.meta.api.methods.send; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import lombok.AllArgsConstructor; import lombok.Builder; @@ -54,6 +55,7 @@ public class SendVideo extends PartialBotApiMethod { public static final String THUMB_FIELD = "thumb"; public static final String CAPTION_ENTITIES_FIELD = "caption_entities"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) @@ -80,6 +82,7 @@ public class SendVideo extends PartialBotApiMethod { @Singular private List captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java index 7839b074..dcaa0c68 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java @@ -1,5 +1,6 @@ package org.telegram.telegrambots.meta.api.methods.send; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import lombok.AllArgsConstructor; import lombok.Builder; @@ -47,6 +48,7 @@ public class SendVideoNote extends PartialBotApiMethod { public static final String REPLYMARKUP_FIELD = "reply_markup"; public static final String THUMB_FIELD = "thumb"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) @@ -66,6 +68,7 @@ public class SendVideoNote extends PartialBotApiMethod { */ private InputFile thumb; private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java index cea1a7c6..907e5b27 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java @@ -1,5 +1,6 @@ package org.telegram.telegrambots.meta.api.methods.send; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import lombok.AllArgsConstructor; import lombok.Builder; @@ -51,6 +52,7 @@ public class SendVoice extends PartialBotApiMethod { public static final String PARSEMODE_FIELD = "parse_mode"; public static final String CAPTION_ENTITIES_FIELD = "caption_entities"; public static final String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + public static final String PROTECTCONTENT_FIELD = "protect_content"; @NonNull private String chatId; ///< Unique identifier for the chat sent message to (Or username for channels) @@ -65,6 +67,7 @@ public class SendVoice extends PartialBotApiMethod { @Singular private List captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode private Boolean allowSendingWithoutReply; ///< Optional Pass True, if the message should be sent even if the specified replied-to message is not found + private Boolean protectContent; ///< Optional. Protects the contents of sent messages from forwarding and saving public void enableNotification() { this.disableNotification = false; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/EntityType.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/EntityType.java index 98882c51..69c9d27f 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/EntityType.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/EntityType.java @@ -20,6 +20,7 @@ public class EntityType { public static final String PRE = "pre"; ///< Monowidth block public static final String TEXTLINK = "text_link"; ///< Clickable urls public static final String TEXTMENTION = "text_mention"; ///< for users without usernames + public static final String SPOILER = "spoiler"; ///< spoiler message private EntityType() { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/MessageEntity.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/MessageEntity.java index b65481de..33eeb9de 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/MessageEntity.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/MessageEntity.java @@ -36,24 +36,25 @@ public class MessageEntity implements BotApiObject { private static final String USER_FIELD = "user"; private static final String LANGUAGE_FIELD = "language"; /** - * Type of the entity. One of - * mention (@username), - * hashtag, - * cashtag - * bot_command, - * url, - * email, - * phone_number, - * bold (bold text), - * italic (italic text), - * code (monowidth string), - * pre (monowidth block), - * text_link (for clickable text URLs), - * text_mention (for users without usernames), - * underline, - * strikethrough + * Type of the entity. + * Currently, can be: + * - “mention” (@username) + * - “hashtag” (#hashtag) + * - “cashtag” ($USD) + * - “bot_command” (/start@jobs_bot) + * - “url” (https://telegram.org) + * - “email” (do-not-reply@telegram.org) + * - “phone_number” (+1-212-555-0123), + * - “bold” (bold text) + * - “italic” (italic text) + * - “underline” (underlined text) + * - “strikethrough” (strikethrough text) + * - “spoiler” (spoiler message) + * - “code” (monowidth string) + * - “pre” (monowidth block) + * - “text_link” (for clickable text URLs) + * - “text_mention” (for users without usernames) */ - @JsonProperty(TYPE_FIELD) @NonNull private String type; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/InputMedia.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/InputMedia.java index 43c82384..b2150eab 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/InputMedia.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/InputMedia.java @@ -43,7 +43,7 @@ public abstract class InputMedia implements Validable, BotApiObject { public static final String MEDIA_FIELD = "media"; public static final String CAPTION_FIELD = "caption"; public static final String PARSEMODE_FIELD = "parse_mode"; - public static final String ENTITIES_FIELD = "caption_entities"; + public static final String CAPTIONENTITIES_FIELD = "caption_entities"; /** * File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), @@ -57,9 +57,9 @@ public abstract class InputMedia implements Validable, BotApiObject { private String caption; ///< Optional. Caption of the media to be sent, 0-200 characters @JsonProperty(PARSEMODE_FIELD) private String parseMode; ///< Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - @JsonProperty(ENTITIES_FIELD) + @JsonProperty(CAPTIONENTITIES_FIELD) @Singular - private List entities; ///< Optional. List of special entities that appear in message text, which can be specified instead of parse_mode + private List captionEntities; ///< Optional. List of special entities that appear in message text, which can be specified instead of parse_mode @JsonIgnore private boolean isNewMedia; ///< True to upload a new media, false to use a fileId or URL @JsonIgnore @@ -117,7 +117,7 @@ public abstract class InputMedia implements Validable, BotApiObject { } else if (media == null || media.isEmpty()) { throw new TelegramApiValidationException("Media can't be empty", this); } - if (parseMode != null && (entities != null && !entities.isEmpty()) ) { + if (parseMode != null && (captionEntities != null && !captionEntities.isEmpty()) ) { throw new TelegramApiValidationException("Parse mode can't be enabled if Entities are provided", this); } } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/serialization/InputMediaSerializer.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/serialization/InputMediaSerializer.java index 565cbd5b..4826450f 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/serialization/InputMediaSerializer.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/media/serialization/InputMediaSerializer.java @@ -31,9 +31,9 @@ public class InputMediaSerializer extends JsonSerializer { if (value.getParseMode() != null) { gen.writeStringField(InputMedia.PARSEMODE_FIELD, value.getParseMode()); } - if (value.getEntities() != null) { - gen.writeArrayFieldStart(InputMedia.ENTITIES_FIELD); - for (MessageEntity entity : value.getEntities()) { + if (value.getCaptionEntities() != null) { + gen.writeArrayFieldStart(InputMedia.CAPTIONENTITIES_FIELD); + for (MessageEntity entity : value.getCaptionEntities()) { gen.writeObject(entity); } gen.writeEndArray(); diff --git a/telegrambots-spring-boot-starter/README.md b/telegrambots-spring-boot-starter/README.md index 5922a78a..a45c787b 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 - 5.5.0 + 5.6.0 ``` **Gradle** ```gradle - implementation 'org.telegram:telegrambots-spring-boot-starter:5.5.0' + implementation 'org.telegram:telegrambots-spring-boot-starter:5.6.0' ``` Motivation diff --git a/telegrambots-spring-boot-starter/pom.xml b/telegrambots-spring-boot-starter/pom.xml index 49b3e754..0395fa72 100644 --- a/telegrambots-spring-boot-starter/pom.xml +++ b/telegrambots-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.5.0 + 5.6.0 telegrambots-spring-boot-starter @@ -70,7 +70,7 @@ UTF-8 UTF-8 - 5.5.0 + 5.6.0 2.4.5 1.6 diff --git a/telegrambots/pom.xml b/telegrambots/pom.xml index 3e498d15..b51bd705 100644 --- a/telegrambots/pom.xml +++ b/telegrambots/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 5.5.0 + 5.6.0 telegrambots @@ -92,7 +92,7 @@ org.telegram telegrambots-meta - 5.5.0 + 5.6.0 org.projectlombok diff --git a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java index 4a2ebbca..8822f710 100644 --- a/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java +++ b/telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultAbsSender.java @@ -176,6 +176,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendDocument.getDisableNotification() != null) { builder.addTextBody(SendDocument.DISABLENOTIFICATION_FIELD, sendDocument.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendDocument.getProtectContent() != null) { + builder.addTextBody(SendDocument.PROTECTCONTENT_FIELD, sendDocument.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendDocument.getAllowSendingWithoutReply() != null) { builder.addTextBody(SendDocument.ALLOWSENDINGWITHOUTREPLY_FIELD, sendDocument.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); @@ -234,6 +237,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendPhoto.getAllowSendingWithoutReply() != null) { builder.addTextBody(SendPhoto.ALLOWSENDINGWITHOUTREPLY_FIELD, sendPhoto.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendPhoto.getProtectContent() != null) { + builder.addTextBody(SendPhoto.PROTECTCONTENT_FIELD, sendPhoto.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendPhoto.getCaptionEntities() != null) { builder.addTextBody(SendPhoto.CAPTION_ENTITIES_FIELD, objectMapper.writeValueAsString(sendPhoto.getCaptionEntities()), TEXT_PLAIN_CONTENT_TYPE); } @@ -288,6 +294,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendVideo.getDisableNotification() != null) { builder.addTextBody(SendVideo.DISABLENOTIFICATION_FIELD, sendVideo.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendVideo.getProtectContent() != null) { + builder.addTextBody(SendVideo.PROTECTCONTENT_FIELD, sendVideo.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendVideo.getThumb() != null) { addInputFile(builder, sendVideo.getThumb(), SendVideo.THUMB_FIELD, false); builder.addTextBody(SendVideo.THUMB_FIELD, sendVideo.getThumb().getAttachName(), TEXT_PLAIN_CONTENT_TYPE); @@ -338,6 +347,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendVideoNote.getDisableNotification() != null) { builder.addTextBody(SendVideoNote.DISABLENOTIFICATION_FIELD, sendVideoNote.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendVideoNote.getProtectContent() != null) { + builder.addTextBody(SendVideoNote.PROTECTCONTENT_FIELD, sendVideoNote.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendVideoNote.getThumb() != null) { addInputFile(builder, sendVideoNote.getThumb(), SendVideoNote.THUMB_FIELD, false); builder.addTextBody(SendVideoNote.THUMB_FIELD, sendVideoNote.getThumb().getAttachName(), TEXT_PLAIN_CONTENT_TYPE); @@ -379,6 +391,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendSticker.getDisableNotification() != null) { builder.addTextBody(SendSticker.DISABLENOTIFICATION_FIELD, sendSticker.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendSticker.getProtectContent() != null) { + builder.addTextBody(SendSticker.PROTECTCONTENT_FIELD, sendSticker.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendSticker.getAllowSendingWithoutReply() != null) { builder.addTextBody(SendSticker.ALLOWSENDINGWITHOUTREPLY_FIELD, sendSticker.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); } @@ -441,6 +456,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendAudio.getAllowSendingWithoutReply() != null) { builder.addTextBody(SendAudio.ALLOWSENDINGWITHOUTREPLY_FIELD, sendAudio.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendAudio.getProtectContent() != null) { + builder.addTextBody(SendAudio.PROTECTCONTENT_FIELD, sendAudio.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendAudio.getCaptionEntities() != null) { builder.addTextBody(SendAudio.CAPTION_ENTITIES_FIELD, objectMapper.writeValueAsString(sendAudio.getCaptionEntities()), TEXT_PLAIN_CONTENT_TYPE); } @@ -496,6 +514,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendVoice.getAllowSendingWithoutReply() != null) { builder.addTextBody(SendVoice.ALLOWSENDINGWITHOUTREPLY_FIELD, sendVoice.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendVoice.getProtectContent() != null) { + builder.addTextBody(SendVoice.PROTECTCONTENT_FIELD, sendVoice.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendVoice.getCaptionEntities() != null) { builder.addTextBody(SendVoice.CAPTION_ENTITIES_FIELD, objectMapper.writeValueAsString(sendVoice.getCaptionEntities()), TEXT_PLAIN_CONTENT_TYPE); } @@ -563,6 +584,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendMediaGroup.getAllowSendingWithoutReply() != null) { builder.addTextBody(SendMediaGroup.ALLOWSENDINGWITHOUTREPLY_FIELD, sendMediaGroup.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendMediaGroup.getProtectContent() != null) { + builder.addTextBody(SendMediaGroup.PROTECTCONTENT_FIELD, sendMediaGroup.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } HttpEntity multipart = builder.build(); @@ -758,6 +782,9 @@ public abstract class DefaultAbsSender extends AbsSender { if (sendAnimation.getAllowSendingWithoutReply() != null) { builder.addTextBody(SendAnimation.ALLOWSENDINGWITHOUTREPLY_FIELD, sendAnimation.getAllowSendingWithoutReply().toString(), TEXT_PLAIN_CONTENT_TYPE); } + if (sendAnimation.getProtectContent() != null) { + builder.addTextBody(SendAnimation.PROTECTCONTENT_FIELD, sendAnimation.getProtectContent().toString(), TEXT_PLAIN_CONTENT_TYPE); + } if (sendAnimation.getCaptionEntities() != null) { builder.addTextBody(SendAnimation.CAPTION_ENTITIES_FIELD, objectMapper.writeValueAsString(sendAnimation.getCaptionEntities()), TEXT_PLAIN_CONTENT_TYPE); }