From 38f9c2210ebe4b4924827f0d7d9e1bfc1adca880 Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Sun, 2 Jun 2024 19:14:55 +0200 Subject: [PATCH] Support Bot API 7.4 --- .../src/Telegram/Bot/API/Games.hs | 1 + .../Bot/API/InlineMode/InlineQueryResult.hs | 1 + .../Bot/API/InlineMode/InputMessageContent.hs | 2 +- .../Telegram/Bot/API/Methods/CopyMessage.hs | 3 ++- .../Telegram/Bot/API/Methods/SendAnimation.hs | 4 ++- .../src/Telegram/Bot/API/Methods/SendAudio.hs | 1 + .../Telegram/Bot/API/Methods/SendContact.hs | 5 ++-- .../src/Telegram/Bot/API/Methods/SendDice.hs | 5 ++-- .../Telegram/Bot/API/Methods/SendDocument.hs | 1 + .../Telegram/Bot/API/Methods/SendLocation.hs | 6 +++-- .../Bot/API/Methods/SendMediaGroup.hs | 6 +++-- .../Telegram/Bot/API/Methods/SendMessage.hs | 1 + .../src/Telegram/Bot/API/Methods/SendPhoto.hs | 2 ++ .../src/Telegram/Bot/API/Methods/SendPoll.hs | 1 + .../src/Telegram/Bot/API/Methods/SendVenue.hs | 5 ++-- .../src/Telegram/Bot/API/Methods/SendVideo.hs | 4 ++- .../Telegram/Bot/API/Methods/SendVideoNote.hs | 2 ++ .../src/Telegram/Bot/API/Methods/SendVoice.hs | 11 ++++---- .../src/Telegram/Bot/API/Payments.hs | 25 +++++++++++++++++-- .../src/Telegram/Bot/API/Stickers.hs | 1 + .../src/Telegram/Bot/API/Types/InputMedia.hs | 1 + .../src/Telegram/Bot/API/Types/Message.hs | 2 ++ .../Telegram/Bot/API/Types/MessageEntity.hs | 1 + .../src/Telegram/Bot/API/UpdatingMessages.hs | 3 ++- 24 files changed, 72 insertions(+), 22 deletions(-) diff --git a/telegram-bot-api/src/Telegram/Bot/API/Games.hs b/telegram-bot-api/src/Telegram/Bot/API/Games.hs index cafcac5..0b0f3dd 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Games.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Games.hs @@ -33,6 +33,7 @@ data SendGameRequest = SendGameRequest , sendGameGameShortName :: Text -- ^ Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. , sendGameDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendGameProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendGameMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendGameReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendGameReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendGameReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. diff --git a/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InlineQueryResult.hs b/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InlineQueryResult.hs index 8a5296d..7cf8d3b 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InlineQueryResult.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InlineQueryResult.hs @@ -31,6 +31,7 @@ data InlineQueryResultGeneric = InlineQueryResultGeneric , inlineQueryResultCaption :: Maybe Text -- ^ Caption of the media to be sent, 0-1024 characters after entities parsing. , inlineQueryResultParseMode :: Maybe Text -- ^ Mode for parsing entities in the photo caption. See formatting options for more details. , inlineQueryResultCaptionEntities :: Maybe [MessageEntity] -- ^ List of special entities that appear in the caption, which can be specified instead of @parse_mode@. + , inlineQueryResultShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. , inlineQueryResultReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Inline keyboard attached to the message. , inlineQueryResultInputMessageContent :: Maybe InputMessageContent -- ^ Content of the message to be sent instead of the media. , inlineQueryResultDescription :: Maybe Text -- ^ Short description of the result. diff --git a/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InputMessageContent.hs b/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InputMessageContent.hs index d0b0ce1..e37ae2d 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InputMessageContent.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/InlineMode/InputMessageContent.hs @@ -43,7 +43,7 @@ data InputMessageContent { inputMessageContentTitle :: Text -- ^ Product name, 1-32 characters. , inputMessageContentDescription :: Text -- ^ Product description, 1-255 characters. , inputMessageContentPayload :: Text -- ^ Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - , inputMessageContentProviderToken :: Text -- ^ Payment provider token, obtained via [@BotFather](https://t.me/botfather). + , inputMessageContentProviderToken :: Text -- ^ Payment provider token, obtained via [@BotFather](https://t.me/botfather). Pass an empty string for payments in [Telegram Stars](https://t.me/BotNews/90). , inputMessageContentCurrency :: Text -- ^ Three-letter ISO 4217 currency code, see [more on currencies](https://core.telegram.org/bots/payments#supported-currencies). , inputMessageContentPrices :: [LabeledPrice] -- ^ Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). , inputMessageContentMaxTipAmount :: Maybe Integer -- ^ The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of @US$ 1.45@ pass @max_tip_amount = 145@. See the exp parameter in [currencies.json](https://core.telegram.org/bots/payments/currencies.json), it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/CopyMessage.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/CopyMessage.hs index ba40889..cdf7185 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/CopyMessage.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/CopyMessage.hs @@ -41,7 +41,8 @@ data CopyMessageRequest = CopyMessageRequest , copyMessageMessageId :: MessageId -- ^ Message identifier in the chat specified in from_chat_id , copyMessageCaption :: Maybe Text -- ^ New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept , copyMessageParseMode :: Maybe ParseMode -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. - , copyMessageCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + , copyMessageCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of @parse_mode@. + , copyMessageShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. , copyMessageDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , copyMessageProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving , copyMessageReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAnimation.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAnimation.hs index 3f14f6c..bb7e137 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAnimation.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAnimation.hs @@ -47,10 +47,12 @@ data SendAnimationRequest = SendAnimationRequest , sendAnimationThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass β€œattach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files Β» , sendAnimationCaption :: Maybe Text -- ^ Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing , sendAnimationParseMode :: Maybe ParseMode -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. - , sendAnimationCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + , sendAnimationCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of @parse_mode@. + , sendAnimationShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. , sendAnimationHasSpoiler :: Maybe Bool -- ^ Pass 'True' if the animation needs to be covered with a spoiler animation. , sendAnimationDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendAnimationProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendAnimationMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendAnimationReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendAnimationReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendAnimationReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAudio.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAudio.hs index a356c4a..7624404 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAudio.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendAudio.hs @@ -50,6 +50,7 @@ data SendAudioRequest = SendAudioRequest , sendAudioCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode , sendAudioDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendAudioProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving + , sendAudioMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendAudioReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message , sendAudioReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendAudioReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendContact.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendContact.hs index b9ba697..ffdd3fa 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendContact.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendContact.hs @@ -28,8 +28,9 @@ data SendContactRequest = SendContactRequest , sendContactLastName :: Text -- ^ Contact's last name , sendContactVcard :: Text -- ^ Additional data about the contact in the form of a vCard, 0-2048 bytes , sendContactDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. - , sendContactProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving - , sendContactReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message + , sendContactProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendContactMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. + , sendContactReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendContactReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendContactReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDice.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDice.hs index daa192d..89589a5 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDice.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDice.hs @@ -25,8 +25,9 @@ data SendDiceRequest = SendDiceRequest , sendDiceMessageThreadId :: Maybe MessageThreadId -- ^ Unique identifier for the target message thread (topic) of the forum; for forum supergroups only. , sendDiceEmoji :: Maybe Text -- ^ Emoji on which the dice throw animation is based. Currently, must be one of β€œπŸŽ²β€, β€œπŸŽ―β€, β€œπŸ€β€, β€œβš½β€, β€œπŸŽ³β€, or β€œπŸŽ°β€. Dice can have values 1-6 for β€œπŸŽ²β€, β€œπŸŽ―β€ and β€œπŸŽ³β€, values 1-5 for β€œπŸ€β€ and β€œβš½β€, and values 1-64 for β€œπŸŽ°β€. Defaults to β€œπŸŽ²β€ , sendDiceDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. - , sendDiceProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding - , sendDiceReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message + , sendDiceProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding. + , sendDiceMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. + , sendDiceReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendDiceReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendDiceReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs index 0a4386c..68dfa21 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendDocument.hs @@ -70,6 +70,7 @@ data SendDocumentRequest = SendDocumentRequest , sendDocumentDisableContentTypeDetection :: Maybe Bool -- ^ Disables automatic server-side content type detection for files uploaded using @multipart/form-data@. , sendDocumentDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendDocumentProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendDocumentMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendDocumentReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendDocumentReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendDocumentReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendLocation.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendLocation.hs index d73a5ef..fb8b67a 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendLocation.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendLocation.hs @@ -6,6 +6,7 @@ module Telegram.Bot.API.Methods.SendLocation where import Data.Aeson (FromJSON (..), ToJSON (..)) import Data.Proxy +import Data.Text (Text) import GHC.Generics (Generic) import Servant.API import Servant.Client hiding (Response) @@ -29,8 +30,9 @@ data SendLocationRequest = SendLocationRequest , sendLocationHeading :: Maybe Int -- ^ Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. , sendLocationProximityAlertRadius :: Maybe Int -- ^ Maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. , sendLocationDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. - , sendLocationProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving - , sendLocationReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message + , sendLocationProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendLocationMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. + , sendLocationReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendLocationReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendLocationReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMediaGroup.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMediaGroup.hs index 8d99ac5..03d96f4 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMediaGroup.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMediaGroup.hs @@ -6,6 +6,7 @@ module Telegram.Bot.API.Methods.SendMediaGroup where import Data.Aeson (ToJSON (..)) import Data.Proxy +import Data.Text (Text) import GHC.Generics (Generic) import Servant.API import Servant.Client hiding (Response) @@ -24,8 +25,9 @@ data SendMediaGroupRequest = SendMediaGroupRequest , sendMediaGroupMessageThreadId :: Maybe MessageThreadId -- ^ Unique identifier for the target message thread (topic) of the forum; for forum supergroups only. , sendMediaGroupMedia :: [InputMedia] -- ^ A JSON-serialized array describing messages to be sent, must include 2-10 items. InputMediaAudio, InputMediaDocument, InputMediaPhoto or InputMediaVideo. , sendMediaGroupDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. - , sendMediaGroupProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving - , sendMediaGroupReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message + , sendMediaGroupProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendMediaGroupMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. + , sendMediaGroupReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendMediaGroupReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendMediaGroupReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMessage.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMessage.hs index ef6592a..34cd3aa 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMessage.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendMessage.hs @@ -39,6 +39,7 @@ data SendMessageRequest = SendMessageRequest , sendMessageLinkPreviewOptions :: Maybe LinkPreviewOptions -- ^ Link preview generation options for the message. , sendMessageDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendMessageProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendMessageMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendMessageReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendMessageReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendMessageReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs index a06cdd7..2b95bfc 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPhoto.hs @@ -69,9 +69,11 @@ data SendPhotoRequest = SendPhotoRequest , sendPhotoCaption :: Maybe Text -- ^ Photo caption (may also be used when resending Photos by file_id), 0-1024 characters after entities parsing , sendPhotoParseMode :: Maybe ParseMode -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. , sendPhotoCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of /parse_mode/. + , sendPhotoShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. , sendPhotoHasSpoiler :: Maybe Bool -- ^ Pass 'True' if the photo needs to be covered with a spoiler animation. , sendPhotoDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendPhotoProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendPhotoMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendPhotoReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendPhotoReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendPhotoReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPoll.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPoll.hs index 813dd2e..fda6fed 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPoll.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendPoll.hs @@ -40,6 +40,7 @@ data SendPollRequest = SendPollRequest , sendPollIsClosed :: Maybe Bool -- ^ Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. , sendPollDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendPollProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendPollMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendPollReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendPollReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendPollReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVenue.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVenue.hs index febc6b8..bf7c762 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVenue.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVenue.hs @@ -32,8 +32,9 @@ data SendVenueRequest = SendVenueRequest , sendVenueGooglePlaceId :: Maybe Text -- ^ Google Places identifier of the venue , sendVenueGooglePlaceType :: Maybe Text -- ^ Google Places type of the venue. (See supported types .) , sendVenueDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. - , sendVenueProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving - , sendVenueReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message + , sendVenueProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendVenueMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. + , sendVenueReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendVenueReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendVenueReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideo.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideo.hs index cf4e00c..0091253 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideo.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideo.hs @@ -47,11 +47,13 @@ data SendVideoRequest = SendVideoRequest , sendVideoThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass β€œattach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files Β» , sendVideoCaption :: Maybe Text -- ^ Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing , sendVideoParseMode :: Maybe ParseMode -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. - , sendVideoCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + , sendVideoCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of @parse_mode@. + , sendVideoShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. , sendVideoHasSpoiler :: Maybe Bool -- ^ Pass 'True' if the video needs to be covered with a spoiler animation. , sendVideoSupportsStreaming :: Maybe Bool -- ^ Pass True, if the uploaded video is suitable for streaming , sendVideoDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendVideoProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendVideoMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendVideoReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message , sendVideoReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendVideoReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideoNote.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideoNote.hs index 230595a..4dc17de 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideoNote.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVideoNote.hs @@ -17,6 +17,7 @@ import Data.Bool import Data.Maybe (catMaybes) import Data.Functor ((<&>)) import Data.Proxy +import Data.Text (Text) import GHC.Generics (Generic) import Servant.API import Servant.Multipart.API @@ -44,6 +45,7 @@ data SendVideoNoteRequest = SendVideoNoteRequest , sendVideoNoteThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass β€œattach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files Β» , sendVideoNoteDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendVideoNoteProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving + , sendVideoNoteMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendVideoNoteReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message , sendVideoNoteReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendVideoNoteReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVoice.hs b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVoice.hs index 9c45d14..0606017 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVoice.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Methods/SendVoice.hs @@ -41,13 +41,14 @@ data SendVoiceRequest = SendVoiceRequest , sendVoiceChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target channel (in the format @channelusername). , sendVoiceMessageThreadId :: Maybe MessageThreadId -- ^ Unique identifier for the target message thread (topic) of the forum; for forum supergroups only. , sendVoiceVoice :: InputFile -- ^ Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files Β» - , sendVoiceCaption :: Maybe Text -- ^ Voice message caption, 0-1024 characters after entities parsing + , sendVoiceCaption :: Maybe Text -- ^ Voice message caption, 0-1024 characters after entities parsing/ , sendVoiceParseMode :: Maybe ParseMode -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. - , sendVoiceCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode - , sendVoiceDuration :: Maybe Int -- ^ Duration of the voice message in seconds + , sendVoiceCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of @parse_mode@. + , sendVoiceDuration :: Maybe Int -- ^ Duration of the voice message in seconds. , sendVoiceDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. - , sendVoiceProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving - , sendVoiceReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message + , sendVoiceProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendVoiceMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. + , sendVoiceReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendVoiceReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendVoiceReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } diff --git a/telegram-bot-api/src/Telegram/Bot/API/Payments.hs b/telegram-bot-api/src/Telegram/Bot/API/Payments.hs index 3991ee3..cbbc969 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Payments.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Payments.hs @@ -26,7 +26,7 @@ data SendInvoiceRequest = SendInvoiceRequest , sendInvoiceTitle :: Text -- ^ Product name, 1-32 characters. , sendInvoiceDescription :: Text -- ^ Product description, 1-255 characters. , sendInvoicePayload :: Text -- ^ Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - , sendInvoiceProviderToken :: Text -- ^ Payments provider token, obtained via Botfather. + , sendInvoiceProviderToken :: Text -- ^ Payments provider token, obtained via [\@Botfather](https://t.me/botfather). Pass an empty string for payments in [Telegram Stars](https://t.me/BotNews/90). , sendInvoiceCurrency :: Text -- ^ Three-letter ISO 4217 currency code, see more on currencies. , sendInvoicePrices :: [LabeledPrice] -- ^ Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). , sendInvoiceMaxTipAmount :: Maybe Integer -- ^ The maximum accepted amount for tips in the smallest units of the currency (integer, not float\/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. @@ -46,6 +46,7 @@ data SendInvoiceRequest = SendInvoiceRequest , sendInvoiceIsFlexible :: Maybe Bool -- ^ Pass 'True', if the final price depends on the shipping method. , sendInvoiceDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendInvoiceProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendInvoiceMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendInvoiceReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message. , sendInvoiceReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendInvoiceReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. @@ -70,7 +71,7 @@ data CreateInvoiceLinkRequest = CreateInvoiceLinkRequest { createInvoiceLinkTitle :: Text -- ^ Product name, 1-32 characters. , createInvoiceLinkDescription :: Text -- ^ Product description, 1-255 characters. , createInvoiceLinkPayload :: Text -- ^ Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - , createInvoiceLinkProviderToken :: Text -- ^ Payment provider token, obtained via BotFather. + , createInvoiceLinkProviderToken :: Text -- ^ Payments provider token, obtained via [\@Botfather](https://t.me/botfather). Pass an empty string for payments in [Telegram Stars](https://t.me/BotNews/90). , createInvoiceLinkCurrency :: Text -- ^ Three-letter ISO 4217 currency code, see more on currencies. , createInvoiceLinkPrices :: [LabeledPrice] -- ^ Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). , createInvoiceLinkMaxTipAmount :: Maybe Integer -- ^ The maximum accepted amount for tips in the smallest units of the currency (integer, not float\/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. @@ -145,6 +146,26 @@ type AnswerPreCheckoutQuery answerPreCheckoutQuery :: AnswerPreCheckoutQueryRequest -> ClientM (Response Bool) answerPreCheckoutQuery = client (Proxy @AnswerPreCheckoutQuery) +-- ** 'refundStarPayment' + +data RefundStarPaymentRequest = RefundStarPaymentRequest + { refundStarPaymentUserId :: UserId -- ^ Identifier of the user whose payment will be refunded. + , refundStarPaymentTelegramPaymentChargeId :: Text -- ^ Telegram payment identifier. + } + deriving (Generic, Show) + +instance ToJSON RefundStarPaymentRequest where toJSON = gtoJSON +instance FromJSON RefundStarPaymentRequest where parseJSON = gparseJSON + +type RefundStarPayment + = "refundStarPayment" + :> ReqBody '[JSON] RefundStarPaymentRequest + :> Post '[JSON] (Response Bool) + +-- | Refunds a successful payment in [Telegram Stars](https://t.me/BotNews/90). Returns 'True' on success. +refundStarPayment :: RefundStarPaymentRequest -> ClientM (Response Bool) +refundStarPayment = client (Proxy @RefundStarPayment) + foldMap makeDefault [ ''SendInvoiceRequest , ''CreateInvoiceLinkRequest diff --git a/telegram-bot-api/src/Telegram/Bot/API/Stickers.hs b/telegram-bot-api/src/Telegram/Bot/API/Stickers.hs index 6297f29..a122faf 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Stickers.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Stickers.hs @@ -52,6 +52,7 @@ data SendStickerRequest = SendStickerRequest , sendStickerSticker :: InputFile -- ^ Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a __.WEBP__ sticker from the Internet, or upload a new __.WEBP__, __.TGS__, or __.WEBM__ sticker using multipart\/form-data. More information on Sending Files Β». Video and animated stickers can't be sent via an HTTP URL. , sendStickerDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound. , sendStickerProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving. + , sendStickerMessageEffectId :: Maybe Text -- ^ Unique identifier of the message effect to be added to the message; for private chats only. , sendStickerReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message , sendStickerReplyParameters :: Maybe ReplyParameters -- ^ Description of the message to reply to. , sendStickerReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Types/InputMedia.hs b/telegram-bot-api/src/Telegram/Bot/API/Types/InputMedia.hs index d763ab8..f95cc46 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Types/InputMedia.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Types/InputMedia.hs @@ -29,6 +29,7 @@ data InputMediaGeneric = InputMediaGeneric , inputMediaGenericCaption :: Maybe Text -- ^ Caption of the photo to be sent, 0-1024 characters after entities parsing. , inputMediaGenericParseMode :: Maybe Text -- ^ Mode for parsing entities in the photo caption. See formatting options for more details. , inputMediaGenericCaptionEntities :: Maybe [MessageEntity] -- ^ List of special entities that appear in the caption, which can be specified instead of @parse_mode@. + , inputMediaGenericShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. } deriving Generic diff --git a/telegram-bot-api/src/Telegram/Bot/API/Types/Message.hs b/telegram-bot-api/src/Telegram/Bot/API/Types/Message.hs index 993ae5c..215bcf1 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Types/Message.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Types/Message.hs @@ -85,6 +85,7 @@ data Message = Message , messageText :: Maybe Text -- ^ For text messages, the actual UTF-8 text of the message, 0-4096 characters. , messageEntities :: Maybe [MessageEntity] -- ^ For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text , messageLinkPreviewOptions :: Maybe LinkPreviewOptions -- ^ Options used for link preview generation for the message, if it is a text message and link preview options were changed. + , messageEffectId :: Maybe Text -- ^ Unique identifier of the message effect added to the message. , messageAnimation :: Maybe Animation -- ^ Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set. , messageAudio :: Maybe Audio -- ^ Message is an audio file, information about the file , messageDocument :: Maybe Document -- ^ Message is a general file, information about the file. @@ -96,6 +97,7 @@ data Message = Message , messageVoice :: Maybe Voice -- ^ Message is a voice message, information about the file , messageCaption :: Maybe Text -- ^ Caption for the audio, document, photo, video or voice, 0-200 characters , messageCaptionEntities :: Maybe [MessageEntity] -- ^ For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption. + , messageShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. , messageHasMediaSpoiler :: Maybe Bool -- ^ 'True', if the message media is covered by a spoiler animation. , messageContact :: Maybe Contact -- ^ Message is a shared contact, information about the contact , messageDice :: Maybe Dice -- ^ Message is a dice with random value. diff --git a/telegram-bot-api/src/Telegram/Bot/API/Types/MessageEntity.hs b/telegram-bot-api/src/Telegram/Bot/API/Types/MessageEntity.hs index 8e77299..960fccc 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/Types/MessageEntity.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/Types/MessageEntity.hs @@ -39,6 +39,7 @@ data MessageEntityType | MessageEntityStrikethrough -- ^ See | MessageEntitySpoiler | MessageEntityBlockquote + | MessageEntityExpandableBlockquote -- ^ See | MessageEntityCode | MessageEntityPre | MessageEntityTextLink diff --git a/telegram-bot-api/src/Telegram/Bot/API/UpdatingMessages.hs b/telegram-bot-api/src/Telegram/Bot/API/UpdatingMessages.hs index 46a6d59..83c5a8a 100644 --- a/telegram-bot-api/src/Telegram/Bot/API/UpdatingMessages.hs +++ b/telegram-bot-api/src/Telegram/Bot/API/UpdatingMessages.hs @@ -49,7 +49,8 @@ data EditMessageCaptionRequest = EditMessageCaptionRequest , editMessageCaptionInlineMessageId :: Maybe MessageId -- ^ Required if 'editMessageCaptionChatId' and 'editMessageCaptionMessageId' are not specified. Identifier of the sent message. , editMessageCaptionCaption :: Maybe Text -- ^ New caption of the message, 0-1024 characters after entities parsing , editMessageCaptionParseMode :: Maybe ParseMode -- ^ Mode for parsing entities in the message caption. See formatting options for more details. - , editMessageCaptionCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + , editMessageCaptionCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of @parse_mode@. + , editMessageCaptionShowCaptionAboveMedia :: Maybe Bool -- ^ Pass 'True', if the caption must be shown above the message media. , editMessageCaptionReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. } deriving (Generic)