From 4f3eb53294dd4b2da57b0decfca75b27a4dc0334 Mon Sep 17 00:00:00 2001 From: johnspade Date: Mon, 10 Jan 2022 22:51:28 +0300 Subject: [PATCH] Telegram Bot API December 30, 2021 updates (v5.6) --- README.md | 2 +- build.sbt | 2 +- .../scala/telegramium/bots/BotCommand.scala | 4 +- .../main/scala/telegramium/bots/Message.scala | 13 +- .../telegramium/bots/MessageEntity.scala | 9 ++ .../bots/client/BanChatSenderChatReq.scala | 5 +- .../bots/client/CopyMessageReq.scala | 3 + .../bots/client/ForwardMessageReq.scala | 3 + .../telegramium/bots/client/Methods.scala | 123 +++++++++++++++--- .../bots/client/SendAnimationReq.scala | 3 + .../bots/client/SendAudioReq.scala | 3 + .../bots/client/SendContactReq.scala | 3 + .../telegramium/bots/client/SendDiceReq.scala | 3 + .../bots/client/SendDocumentReq.scala | 3 + .../telegramium/bots/client/SendGameReq.scala | 3 + .../bots/client/SendInvoiceReq.scala | 3 + .../bots/client/SendLocationReq.scala | 3 + .../bots/client/SendMediaGroupReq.scala | 3 + .../bots/client/SendMessageReq.scala | 3 + .../bots/client/SendPhotoReq.scala | 3 + .../telegramium/bots/client/SendPollReq.scala | 3 + .../bots/client/SendStickerReq.scala | 3 + .../bots/client/SendVenueReq.scala | 3 + .../bots/client/SendVideoNoteReq.scala | 3 + .../bots/client/SendVideoReq.scala | 3 + .../bots/client/SendVoiceReq.scala | 3 + .../telegramium/bots/client/package.scala | 61 ++++++++- .../main/scala/telegramium/bots/package.scala | 22 ++++ 28 files changed, 266 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 30fa1a34..a88f5b84 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # F[Tg] - Telegramium -[![Telegram](https://img.shields.io/badge/Telegram%20Bot%20API-5.5%20(December%207%2C%202021)-blue)](https://core.telegram.org/bots/api#recent-changes) +[![Telegram](https://img.shields.io/badge/Telegram%20Bot%20API-5.6%20(December%2030%2C%202021)-blue)](https://core.telegram.org/bots/api#recent-changes) [![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.apimorphism/telegramium-core_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.apimorphism/telegramium-core_2.13) diff --git a/build.sbt b/build.sbt index 5d847734..aad3f338 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ enablePlugins(GitPlugin) ThisBuild / version := Version.mkVersion( - "7.55.0", + "7.56.0", git.gitCurrentBranch.value, git.gitDescribedVersion.value, git.gitUncommittedChanges.value diff --git a/telegramium-core/src/main/scala/telegramium/bots/BotCommand.scala b/telegramium-core/src/main/scala/telegramium/bots/BotCommand.scala index 9348ec23..5aea4edd 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/BotCommand.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/BotCommand.scala @@ -3,8 +3,8 @@ package telegramium.bots /** This object represents a bot command. * * @param command - * Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores. + * Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. * @param description - * Description of the command, 3-256 characters. + * Description of the command; 1-256 characters. */ final case class BotCommand(command: String, description: String) diff --git a/telegramium-core/src/main/scala/telegramium/bots/Message.scala b/telegramium-core/src/main/scala/telegramium/bots/Message.scala index 96eeb3ac..a818b577 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/Message.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/Message.scala @@ -5,11 +5,13 @@ package telegramium.bots * @param messageId * Unique message identifier inside this chat * @param from - * Optional. Sender, empty for messages sent to channels + * Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field + * contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. * @param senderChat - * Optional. Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The supergroup - * itself for messages from anonymous group administrators. The linked channel for messages automatically forwarded - * to the discussion group + * Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the + * supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically + * forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in + * non-channel chats, if the message was sent on behalf of a chat. * @param date * Date the message was sent in Unix time * @param chat @@ -22,7 +24,8 @@ package telegramium.bots * @param forwardFromMessageId * Optional. For messages forwarded from channels, identifier of the original message in the channel * @param forwardSignature - * Optional. For messages forwarded from channels, signature of the post author if present + * Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, + * signature of the message sender if present * @param forwardSenderName * Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded * messages diff --git a/telegramium-core/src/main/scala/telegramium/bots/MessageEntity.scala b/telegramium-core/src/main/scala/telegramium/bots/MessageEntity.scala index c22e7049..3d7dd419 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/MessageEntity.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/MessageEntity.scala @@ -45,6 +45,15 @@ final case class CodeMessageEntity(offset: Int, length: Int) extends MessageEnti */ final case class BotCommandMessageEntity(offset: Int, length: Int) extends MessageEntity +/** spoiler + * + * @param offset + * Offset in UTF-16 code units to the start of the entity + * @param length + * Length of the entity in UTF-16 code units + */ +final case class SpoilerMessageEntity(offset: Int, length: Int) extends MessageEntity + /** email * * @param offset diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/BanChatSenderChatReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/BanChatSenderChatReq.scala index fb2527c3..6bafddc6 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/BanChatSenderChatReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/BanChatSenderChatReq.scala @@ -6,8 +6,5 @@ import telegramium.bots.ChatId * Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param senderChatId * Unique identifier of the target sender chat - * @param untilDate - * Date when the sender chat will be unbanned, unix time. If the chat is banned for more than 366 days or less than - * 30 seconds from the current time they are considered to be banned forever. */ -final case class BanChatSenderChatReq(chatId: ChatId, senderChatId: Int, untilDate: Option[Int] = Option.empty) +final case class BanChatSenderChatReq(chatId: ChatId, senderChatId: Int) diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/CopyMessageReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/CopyMessageReq.scala index 1b842fe6..d8d4e539 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/CopyMessageReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/CopyMessageReq.scala @@ -21,6 +21,8 @@ import telegramium.bots.KeyboardMarkup * parse_mode * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -37,6 +39,7 @@ final case class CopyMessageReq( parseMode: Option[ParseMode] = Option.empty, captionEntities: List[MessageEntity] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/ForwardMessageReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/ForwardMessageReq.scala index 2f981bda..23609b54 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/ForwardMessageReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/ForwardMessageReq.scala @@ -9,6 +9,8 @@ import telegramium.bots.ChatId * @channelusername) * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the forwarded message from forwarding and saving * @param messageId * Message identifier in the chat specified in from_chat_id */ @@ -16,5 +18,6 @@ final case class ForwardMessageReq( chatId: ChatId, fromChatId: ChatId, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, messageId: Int ) diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/Methods.scala b/telegramium-core/src/main/scala/telegramium/bots/client/Methods.scala index aba7ec52..1a3090c2 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/Methods.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/Methods.scala @@ -155,6 +155,8 @@ trait Methods { * Disables link previews for links in this message * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -170,6 +172,7 @@ trait Methods { entities: List[MessageEntity] = List.empty, disableWebPagePreview: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -181,6 +184,7 @@ trait Methods { entities, disableWebPagePreview, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -239,6 +243,8 @@ trait Methods { * Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -262,6 +268,7 @@ trait Methods { closeDate: Option[Int] = Option.empty, isClosed: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -281,6 +288,7 @@ trait Methods { closeDate, isClosed, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -302,6 +310,8 @@ trait Methods { * Additional data about the contact in the form of a vCard, 0-2048 bytes * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -317,6 +327,7 @@ trait Methods { lastName: Option[String] = Option.empty, vcard: Option[String] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -328,6 +339,7 @@ trait Methods { lastName, vcard, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -412,21 +424,18 @@ trait Methods { MethodReq[Boolean]("setChatPermissions", req.asJson) } - /** Use this method to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send - * messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an - * administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. - * Returns True on success. + /** Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the + * banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in + * the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on + * success. * * @param chatId * Unique identifier for the target chat or username of the target channel (in the format @channelusername) * @param senderChatId * Unique identifier of the target sender chat - * @param untilDate - * Date when the sender chat will be unbanned, unix time. If the chat is banned for more than 366 days or less than - * 30 seconds from the current time they are considered to be banned forever. */ - def banChatSenderChat(chatId: ChatId, senderChatId: Int, untilDate: Option[Int] = Option.empty): Method[Boolean] = { - val req = BanChatSenderChatReq(chatId, senderChatId, untilDate) + def banChatSenderChat(chatId: ChatId, senderChatId: Int): Method[Boolean] = { + val req = BanChatSenderChatReq(chatId, senderChatId) MethodReq[Boolean]("banChatSenderChat", req.asJson) } @@ -449,6 +458,8 @@ trait Methods { * Must be between 1 and 100000 if specified. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -466,6 +477,7 @@ trait Methods { heading: Option[Int] = Option.empty, proximityAlertRadius: Option[Int] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -479,6 +491,7 @@ trait Methods { heading, proximityAlertRadius, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -559,6 +572,8 @@ trait Methods { * EmojiSlotMachine. Defaults to EmojiDice * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -571,11 +586,20 @@ trait Methods { chatId: ChatId, emoji: Option[Emoji] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty ): Method[Message] = { - val req = SendDiceReq(chatId, emoji, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) + val req = SendDiceReq( + chatId, + emoji, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup + ) MethodReq[Message]("sendDice", req.asJson) } @@ -698,6 +722,8 @@ trait Methods { * A JSON-serialized array describing messages to be sent, must include 2-10 items * @param disableNotification * Sends messages silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent messages from forwarding and saving * @param replyToMessageId * If the messages are a reply, ID of the original message * @param allowSendingWithoutReply @@ -707,10 +733,12 @@ trait Methods { chatId: ChatId, media: List[InputMedia] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty ): Method[List[Message]] = { - val req = SendMediaGroupReq(chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply) + val req = + SendMediaGroupReq(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) MethodReq[List[Message]]("sendMediaGroup", req.asJson) } @@ -722,6 +750,8 @@ trait Methods { * Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -734,12 +764,20 @@ trait Methods { chatId: Int, gameShortName: String, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[InlineKeyboardMarkup] = Option.empty ): Method[Message] = { - val req = - SendGameReq(chatId, gameShortName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) + val req = SendGameReq( + chatId, + gameShortName, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup + ) MethodReq[Message]("sendGame", req.asJson) } @@ -766,6 +804,8 @@ trait Methods { * Google Places type of the venue. (See supported types.) * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -785,6 +825,7 @@ trait Methods { googlePlaceId: Option[String] = Option.empty, googlePlaceType: Option[String] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -800,6 +841,7 @@ trait Methods { googlePlaceId, googlePlaceType, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -1025,6 +1067,8 @@ trait Methods { * parse_mode * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -1041,6 +1085,7 @@ trait Methods { parseMode: Option[ParseMode] = Option.empty, captionEntities: List[MessageEntity] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -1053,6 +1098,7 @@ trait Methods { parseMode, captionEntities, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -1081,6 +1127,8 @@ trait Methods { * multipart/form-data under . * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -1096,6 +1144,7 @@ trait Methods { length: Option[Int] = Option.empty, thumb: Option[IFile] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -1107,6 +1156,7 @@ trait Methods { length, thumb, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -1238,6 +1288,8 @@ trait Methods { * Pass True, if the final price depends on the shipping method * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -1270,6 +1322,7 @@ trait Methods { sendEmailToProvider: Option[Boolean] = Option.empty, isFlexible: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[InlineKeyboardMarkup] = Option.empty @@ -1298,6 +1351,7 @@ trait Methods { sendEmailToProvider, isFlexible, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -1332,6 +1386,8 @@ trait Methods { * Disables automatic server-side content type detection for files uploaded using multipart/form-data * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -1349,6 +1405,7 @@ trait Methods { captionEntities: List[MessageEntity] = List.empty, disableContentTypeDetection: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -1362,6 +1419,7 @@ trait Methods { captionEntities, disableContentTypeDetection, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -1479,6 +1537,8 @@ trait Methods { * multipart/form-data under . * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -1498,6 +1558,7 @@ trait Methods { title: Option[String] = Option.empty, thumb: Option[IFile] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -1513,6 +1574,7 @@ trait Methods { title, thumb, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -1567,6 +1629,8 @@ trait Methods { * @channelusername) * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the forwarded message from forwarding and saving * @param messageId * Message identifier in the chat specified in from_chat_id */ @@ -1574,9 +1638,10 @@ trait Methods { chatId: ChatId, fromChatId: ChatId, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, messageId: Int ): Method[Message] = { - val req = ForwardMessageReq(chatId, fromChatId, disableNotification, messageId) + val req = ForwardMessageReq(chatId, fromChatId, disableNotification, protectContent, messageId) MethodReq[Message]("forwardMessage", req.asJson) } @@ -1672,6 +1737,8 @@ trait Methods { * Duration of the voice message in seconds * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -1688,6 +1755,7 @@ trait Methods { captionEntities: List[MessageEntity] = List.empty, duration: Option[Int] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -1700,6 +1768,7 @@ trait Methods { captionEntities, duration, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -1991,6 +2060,8 @@ trait Methods { * Pass True, if the uploaded video is suitable for streaming * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -2011,6 +2082,7 @@ trait Methods { captionEntities: List[MessageEntity] = List.empty, supportsStreaming: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -2027,6 +2099,7 @@ trait Methods { captionEntities, supportsStreaming, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -2159,6 +2232,8 @@ trait Methods { * parse_mode * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -2178,6 +2253,7 @@ trait Methods { parseMode: Option[ParseMode] = Option.empty, captionEntities: List[MessageEntity] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -2193,6 +2269,7 @@ trait Methods { parseMode, captionEntities, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup @@ -2278,6 +2355,8 @@ trait Methods { * multipart/form-data. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -2290,12 +2369,20 @@ trait Methods { chatId: ChatId, sticker: IFile, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty ): Method[Message] = { - val req = - SendStickerReq(chatId, sticker, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) + val req = SendStickerReq( + chatId, + sticker, + disableNotification, + protectContent, + replyToMessageId, + allowSendingWithoutReply, + replyMarkup + ) MethodReq[Message]( "sendSticker", req.asJson, @@ -2321,6 +2408,8 @@ trait Methods { * parse_mode * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -2336,6 +2425,7 @@ trait Methods { parseMode: Option[ParseMode] = Option.empty, captionEntities: List[MessageEntity] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty @@ -2347,6 +2437,7 @@ trait Methods { parseMode, captionEntities, disableNotification, + protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendAnimationReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendAnimationReq.scala index 007ae52d..5934197d 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendAnimationReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendAnimationReq.scala @@ -33,6 +33,8 @@ import telegramium.bots.KeyboardMarkup * parse_mode * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -52,6 +54,7 @@ final case class SendAnimationReq( parseMode: Option[ParseMode] = Option.empty, captionEntities: List[MessageEntity] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendAudioReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendAudioReq.scala index 4c70060f..ba5d5a8f 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendAudioReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendAudioReq.scala @@ -33,6 +33,8 @@ import telegramium.bots.KeyboardMarkup * multipart/form-data under . * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -52,6 +54,7 @@ final case class SendAudioReq( title: Option[String] = Option.empty, thumb: Option[IFile] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendContactReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendContactReq.scala index 52047819..87e73e8d 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendContactReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendContactReq.scala @@ -15,6 +15,8 @@ import telegramium.bots.KeyboardMarkup * Additional data about the contact in the form of a vCard, 0-2048 bytes * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -30,6 +32,7 @@ final case class SendContactReq( lastName: Option[String] = Option.empty, vcard: Option[String] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendDiceReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendDiceReq.scala index b128149e..69184a2d 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendDiceReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendDiceReq.scala @@ -13,6 +13,8 @@ import telegramium.bots.KeyboardMarkup * EmojiSlotMachine. Defaults to EmojiDice * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -25,6 +27,7 @@ final case class SendDiceReq( chatId: ChatId, emoji: Option[Emoji] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendDocumentReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendDocumentReq.scala index 255e9262..8487a371 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendDocumentReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendDocumentReq.scala @@ -28,6 +28,8 @@ import telegramium.bots.KeyboardMarkup * Disables automatic server-side content type detection for files uploaded using multipart/form-data * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -45,6 +47,7 @@ final case class SendDocumentReq( captionEntities: List[MessageEntity] = List.empty, disableContentTypeDetection: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendGameReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendGameReq.scala index 0491f47f..f7557c8c 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendGameReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendGameReq.scala @@ -8,6 +8,8 @@ import telegramium.bots.InlineKeyboardMarkup * Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -20,6 +22,7 @@ final case class SendGameReq( chatId: Int, gameShortName: String, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[InlineKeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendInvoiceReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendInvoiceReq.scala index ba739715..00118357 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendInvoiceReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendInvoiceReq.scala @@ -61,6 +61,8 @@ import telegramium.bots.InlineKeyboardMarkup * Pass True, if the final price depends on the shipping method * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -93,6 +95,7 @@ final case class SendInvoiceReq( sendEmailToProvider: Option[Boolean] = Option.empty, isFlexible: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[InlineKeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendLocationReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendLocationReq.scala index b20ab5ff..782854ac 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendLocationReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendLocationReq.scala @@ -20,6 +20,8 @@ import telegramium.bots.KeyboardMarkup * be between 1 and 100000 if specified. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -37,6 +39,7 @@ final case class SendLocationReq( heading: Option[Int] = Option.empty, proximityAlertRadius: Option[Int] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendMediaGroupReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendMediaGroupReq.scala index e708e0f1..ca1663a2 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendMediaGroupReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendMediaGroupReq.scala @@ -9,6 +9,8 @@ import telegramium.bots.InputMedia * A JSON-serialized array describing messages to be sent, must include 2-10 items * @param disableNotification * Sends messages silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent messages from forwarding and saving * @param replyToMessageId * If the messages are a reply, ID of the original message * @param allowSendingWithoutReply @@ -18,6 +20,7 @@ final case class SendMediaGroupReq( chatId: ChatId, media: List[InputMedia] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty ) diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendMessageReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendMessageReq.scala index 52a24e23..c35b80f4 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendMessageReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendMessageReq.scala @@ -18,6 +18,8 @@ import telegramium.bots.KeyboardMarkup * Disables link previews for links in this message * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -33,6 +35,7 @@ final case class SendMessageReq( entities: List[MessageEntity] = List.empty, disableWebPagePreview: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendPhotoReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendPhotoReq.scala index 7cd2db2d..859c742a 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendPhotoReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendPhotoReq.scala @@ -22,6 +22,8 @@ import telegramium.bots.KeyboardMarkup * parse_mode * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -37,6 +39,7 @@ final case class SendPhotoReq( parseMode: Option[ParseMode] = Option.empty, captionEntities: List[MessageEntity] = List.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendPollReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendPollReq.scala index 54d99068..806f669e 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendPollReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendPollReq.scala @@ -35,6 +35,8 @@ import telegramium.bots.KeyboardMarkup * Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -58,6 +60,7 @@ final case class SendPollReq( closeDate: Option[Int] = Option.empty, isClosed: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendStickerReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendStickerReq.scala index ee8c34a0..1547da10 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendStickerReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendStickerReq.scala @@ -12,6 +12,8 @@ import telegramium.bots.KeyboardMarkup * multipart/form-data. * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -24,6 +26,7 @@ final case class SendStickerReq( chatId: ChatId, sticker: IFile, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendVenueReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendVenueReq.scala index d5cef349..ed4d1d5e 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendVenueReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendVenueReq.scala @@ -24,6 +24,8 @@ import telegramium.bots.KeyboardMarkup * Google Places type of the venue. (See supported types.) * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -43,6 +45,7 @@ final case class SendVenueReq( googlePlaceId: Option[String] = Option.empty, googlePlaceType: Option[String] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoNoteReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoNoteReq.scala index 8aaff05d..74eff42b 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoNoteReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoNoteReq.scala @@ -22,6 +22,8 @@ import telegramium.bots.KeyboardMarkup * multipart/form-data under . * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -37,6 +39,7 @@ final case class SendVideoNoteReq( length: Option[Int] = Option.empty, thumb: Option[IFile] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoReq.scala index ce93e69c..37e38068 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendVideoReq.scala @@ -35,6 +35,8 @@ import telegramium.bots.KeyboardMarkup * Pass True, if the uploaded video is suitable for streaming * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -55,6 +57,7 @@ final case class SendVideoReq( captionEntities: List[MessageEntity] = List.empty, supportsStreaming: Option[Boolean] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/SendVoiceReq.scala b/telegramium-core/src/main/scala/telegramium/bots/client/SendVoiceReq.scala index 4b7183ae..30e6ea12 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/SendVoiceReq.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/SendVoiceReq.scala @@ -23,6 +23,8 @@ import telegramium.bots.KeyboardMarkup * Duration of the voice message in seconds * @param disableNotification * Sends the message silently. Users will receive a notification with no sound. + * @param protectContent + * Protects the contents of the sent message from forwarding and saving * @param replyToMessageId * If the message is a reply, ID of the original message * @param allowSendingWithoutReply @@ -39,6 +41,7 @@ final case class SendVoiceReq( captionEntities: List[MessageEntity] = List.empty, duration: Option[Int] = Option.empty, disableNotification: Option[Boolean] = Option.empty, + protectContent: Option[Boolean] = Option.empty, replyToMessageId: Option[Int] = Option.empty, allowSendingWithoutReply: Option[Boolean] = Option.empty, replyMarkup: Option[KeyboardMarkup] = Option.empty diff --git a/telegramium-core/src/main/scala/telegramium/bots/client/package.scala b/telegramium-core/src/main/scala/telegramium/bots/client/package.scala index a7b0fcae..074adefc 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/client/package.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/client/package.scala @@ -182,6 +182,7 @@ object CirceImplicits { "entities" -> x.entities.asJson, "disable_web_page_preview" -> x.disableWebPagePreview.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -199,6 +200,7 @@ object CirceImplicits { _entities <- h.getOrElse[List[MessageEntity]]("entities")(List.empty) _disableWebPagePreview <- h.get[Option[Boolean]]("disable_web_page_preview") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -210,6 +212,7 @@ object CirceImplicits { entities = _entities, disableWebPagePreview = _disableWebPagePreview, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -258,6 +261,7 @@ object CirceImplicits { "close_date" -> x.closeDate.asJson, "is_closed" -> x.isClosed.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -283,6 +287,7 @@ object CirceImplicits { _closeDate <- h.get[Option[Int]]("close_date") _isClosed <- h.get[Option[Boolean]]("is_closed") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -302,6 +307,7 @@ object CirceImplicits { closeDate = _closeDate, isClosed = _isClosed, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -319,6 +325,7 @@ object CirceImplicits { "last_name" -> x.lastName.asJson, "vcard" -> x.vcard.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -336,6 +343,7 @@ object CirceImplicits { _lastName <- h.get[Option[String]]("last_name") _vcard <- h.get[Option[String]]("vcard") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -347,6 +355,7 @@ object CirceImplicits { lastName = _lastName, vcard = _vcard, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -444,7 +453,6 @@ object CirceImplicits { List( "chat_id" -> x.chatId.asJson, "sender_chat_id" -> x.senderChatId.asJson, - "until_date" -> x.untilDate.asJson, "method" -> "banChatSenderChat".asJson ).filter(!_._2.isNull) ) @@ -455,9 +463,8 @@ object CirceImplicits { for { _chatId <- h.get[ChatId]("chat_id") _senderChatId <- h.get[Int]("sender_chat_id") - _untilDate <- h.get[Option[Int]]("until_date") } yield { - BanChatSenderChatReq(chatId = _chatId, senderChatId = _senderChatId, untilDate = _untilDate) + BanChatSenderChatReq(chatId = _chatId, senderChatId = _senderChatId) } } @@ -473,6 +480,7 @@ object CirceImplicits { "heading" -> x.heading.asJson, "proximity_alert_radius" -> x.proximityAlertRadius.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -492,6 +500,7 @@ object CirceImplicits { _heading <- h.get[Option[Int]]("heading") _proximityAlertRadius <- h.get[Option[Int]]("proximity_alert_radius") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -505,6 +514,7 @@ object CirceImplicits { heading = _heading, proximityAlertRadius = _proximityAlertRadius, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -608,6 +618,7 @@ object CirceImplicits { "chat_id" -> x.chatId.asJson, "emoji" -> x.emoji.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -622,6 +633,7 @@ object CirceImplicits { _chatId <- h.get[ChatId]("chat_id") _emoji <- h.get[Option[Emoji]]("emoji") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -630,6 +642,7 @@ object CirceImplicits { chatId = _chatId, emoji = _emoji, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -783,6 +796,7 @@ object CirceImplicits { "chat_id" -> x.chatId.asJson, "media" -> x.media.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "method" -> "sendMediaGroup".asJson @@ -796,6 +810,7 @@ object CirceImplicits { _chatId <- h.get[ChatId]("chat_id") _media <- h.getOrElse[List[InputMedia]]("media")(List.empty) _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") } yield { @@ -803,6 +818,7 @@ object CirceImplicits { chatId = _chatId, media = _media, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply ) @@ -816,6 +832,7 @@ object CirceImplicits { "chat_id" -> x.chatId.asJson, "game_short_name" -> x.gameShortName.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -830,6 +847,7 @@ object CirceImplicits { _chatId <- h.get[Int]("chat_id") _gameShortName <- h.get[String]("game_short_name") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[InlineKeyboardMarkup]]("reply_markup") @@ -838,6 +856,7 @@ object CirceImplicits { chatId = _chatId, gameShortName = _gameShortName, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -859,6 +878,7 @@ object CirceImplicits { "google_place_id" -> x.googlePlaceId.asJson, "google_place_type" -> x.googlePlaceType.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -880,6 +900,7 @@ object CirceImplicits { _googlePlaceId <- h.get[Option[String]]("google_place_id") _googlePlaceType <- h.get[Option[String]]("google_place_type") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -895,6 +916,7 @@ object CirceImplicits { googlePlaceId = _googlePlaceId, googlePlaceType = _googlePlaceType, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -1142,6 +1164,7 @@ object CirceImplicits { "parse_mode" -> x.parseMode.asJson, "caption_entities" -> x.captionEntities.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -1160,6 +1183,7 @@ object CirceImplicits { _parseMode <- h.get[Option[ParseMode]]("parse_mode") _captionEntities <- h.getOrElse[List[MessageEntity]]("caption_entities")(List.empty) _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -1172,6 +1196,7 @@ object CirceImplicits { parseMode = _parseMode, captionEntities = _captionEntities, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -1189,6 +1214,7 @@ object CirceImplicits { "length" -> x.length.asJson, "thumb" -> x.thumb.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -1206,6 +1232,7 @@ object CirceImplicits { _length <- h.get[Option[Int]]("length") _thumb <- h.get[Option[IFile]]("thumb") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -1217,6 +1244,7 @@ object CirceImplicits { length = _length, thumb = _thumb, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -1327,6 +1355,7 @@ object CirceImplicits { "send_email_to_provider" -> x.sendEmailToProvider.asJson, "is_flexible" -> x.isFlexible.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -1361,6 +1390,7 @@ object CirceImplicits { _sendEmailToProvider <- h.get[Option[Boolean]]("send_email_to_provider") _isFlexible <- h.get[Option[Boolean]]("is_flexible") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[InlineKeyboardMarkup]]("reply_markup") @@ -1389,6 +1419,7 @@ object CirceImplicits { sendEmailToProvider = _sendEmailToProvider, isFlexible = _isFlexible, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -1408,6 +1439,7 @@ object CirceImplicits { "caption_entities" -> x.captionEntities.asJson, "disable_content_type_detection" -> x.disableContentTypeDetection.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -1427,6 +1459,7 @@ object CirceImplicits { _captionEntities <- h.getOrElse[List[MessageEntity]]("caption_entities")(List.empty) _disableContentTypeDetection <- h.get[Option[Boolean]]("disable_content_type_detection") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -1440,6 +1473,7 @@ object CirceImplicits { captionEntities = _captionEntities, disableContentTypeDetection = _disableContentTypeDetection, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -1542,6 +1576,7 @@ object CirceImplicits { "title" -> x.title.asJson, "thumb" -> x.thumb.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -1563,6 +1598,7 @@ object CirceImplicits { _title <- h.get[Option[String]]("title") _thumb <- h.get[Option[IFile]]("thumb") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -1578,6 +1614,7 @@ object CirceImplicits { title = _title, thumb = _thumb, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -1620,6 +1657,7 @@ object CirceImplicits { "chat_id" -> x.chatId.asJson, "from_chat_id" -> x.fromChatId.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "message_id" -> x.messageId.asJson, "method" -> "forwardMessage".asJson ).filter(!_._2.isNull) @@ -1632,12 +1670,14 @@ object CirceImplicits { _chatId <- h.get[ChatId]("chat_id") _fromChatId <- h.get[ChatId]("from_chat_id") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _messageId <- h.get[Int]("message_id") } yield { ForwardMessageReq( chatId = _chatId, fromChatId = _fromChatId, disableNotification = _disableNotification, + protectContent = _protectContent, messageId = _messageId ) } @@ -1740,6 +1780,7 @@ object CirceImplicits { "caption_entities" -> x.captionEntities.asJson, "duration" -> x.duration.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -1758,6 +1799,7 @@ object CirceImplicits { _captionEntities <- h.getOrElse[List[MessageEntity]]("caption_entities")(List.empty) _duration <- h.get[Option[Int]]("duration") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -1770,6 +1812,7 @@ object CirceImplicits { captionEntities = _captionEntities, duration = _duration, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -2054,6 +2097,7 @@ object CirceImplicits { "caption_entities" -> x.captionEntities.asJson, "supports_streaming" -> x.supportsStreaming.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -2076,6 +2120,7 @@ object CirceImplicits { _captionEntities <- h.getOrElse[List[MessageEntity]]("caption_entities")(List.empty) _supportsStreaming <- h.get[Option[Boolean]]("supports_streaming") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -2092,6 +2137,7 @@ object CirceImplicits { captionEntities = _captionEntities, supportsStreaming = _supportsStreaming, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -2240,6 +2286,7 @@ object CirceImplicits { "parse_mode" -> x.parseMode.asJson, "caption_entities" -> x.captionEntities.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -2261,6 +2308,7 @@ object CirceImplicits { _parseMode <- h.get[Option[ParseMode]]("parse_mode") _captionEntities <- h.getOrElse[List[MessageEntity]]("caption_entities")(List.empty) _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -2276,6 +2324,7 @@ object CirceImplicits { parseMode = _parseMode, captionEntities = _captionEntities, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -2364,6 +2413,7 @@ object CirceImplicits { "chat_id" -> x.chatId.asJson, "sticker" -> x.sticker.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -2378,6 +2428,7 @@ object CirceImplicits { _chatId <- h.get[ChatId]("chat_id") _sticker <- h.get[IFile]("sticker") _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -2386,6 +2437,7 @@ object CirceImplicits { chatId = _chatId, sticker = _sticker, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup @@ -2403,6 +2455,7 @@ object CirceImplicits { "parse_mode" -> x.parseMode.asJson, "caption_entities" -> x.captionEntities.asJson, "disable_notification" -> x.disableNotification.asJson, + "protect_content" -> x.protectContent.asJson, "reply_to_message_id" -> x.replyToMessageId.asJson, "allow_sending_without_reply" -> x.allowSendingWithoutReply.asJson, "reply_markup" -> x.replyMarkup.asJson, @@ -2420,6 +2473,7 @@ object CirceImplicits { _parseMode <- h.get[Option[ParseMode]]("parse_mode") _captionEntities <- h.getOrElse[List[MessageEntity]]("caption_entities")(List.empty) _disableNotification <- h.get[Option[Boolean]]("disable_notification") + _protectContent <- h.get[Option[Boolean]]("protect_content") _replyToMessageId <- h.get[Option[Int]]("reply_to_message_id") _allowSendingWithoutReply <- h.get[Option[Boolean]]("allow_sending_without_reply") _replyMarkup <- h.get[Option[KeyboardMarkup]]("reply_markup") @@ -2431,6 +2485,7 @@ object CirceImplicits { parseMode = _parseMode, captionEntities = _captionEntities, disableNotification = _disableNotification, + protectContent = _protectContent, replyToMessageId = _replyToMessageId, allowSendingWithoutReply = _allowSendingWithoutReply, replyMarkup = _replyMarkup diff --git a/telegramium-core/src/main/scala/telegramium/bots/package.scala b/telegramium-core/src/main/scala/telegramium/bots/package.scala index 6ed01399..a70fed8d 100644 --- a/telegramium-core/src/main/scala/telegramium/bots/package.scala +++ b/telegramium-core/src/main/scala/telegramium/bots/package.scala @@ -2209,6 +2209,7 @@ object CirceImplicits { case bold: BoldMessageEntity => bold.asJson.mapObject(_.add("type", Json.fromString("bold"))) case cashtag: CashtagMessageEntity => cashtag.asJson.mapObject(_.add("type", Json.fromString("cashtag"))) case code: CodeMessageEntity => code.asJson.mapObject(_.add("type", Json.fromString("code"))) + case spoiler: SpoilerMessageEntity => spoiler.asJson.mapObject(_.add("type", Json.fromString("spoiler"))) case mention: MentionMessageEntity => mention.asJson.mapObject(_.add("type", Json.fromString("mention"))) case hashtag: HashtagMessageEntity => hashtag.asJson.mapObject(_.add("type", Json.fromString("hashtag"))) case text_link: TextLinkMessageEntity => text_link.asJson.mapObject(_.add("type", Json.fromString("text_link"))) @@ -2230,6 +2231,7 @@ object CirceImplicits { case "bold" => Decoder[BoldMessageEntity] case "cashtag" => Decoder[CashtagMessageEntity] case "code" => Decoder[CodeMessageEntity] + case "spoiler" => Decoder[SpoilerMessageEntity] case "mention" => Decoder[MentionMessageEntity] case "hashtag" => Decoder[HashtagMessageEntity] case "text_link" => Decoder[TextLinkMessageEntity] @@ -2317,6 +2319,26 @@ object CirceImplicits { } } + implicit lazy val spoilermessageentityEncoder: Encoder[SpoilerMessageEntity] = + (x: SpoilerMessageEntity) => { + Json.fromFields( + List( + "offset" -> x.offset.asJson, + "length" -> x.length.asJson + ).filter(!_._2.isNull) + ) + } + + implicit lazy val spoilermessageentityDecoder: Decoder[SpoilerMessageEntity] = + Decoder.instance { h => + for { + _offset <- h.get[Int]("offset") + _length <- h.get[Int]("length") + } yield { + SpoilerMessageEntity(offset = _offset, length = _length) + } + } + implicit lazy val emailmessageentityEncoder: Encoder[EmailMessageEntity] = (x: EmailMessageEntity) => { Json.fromFields(