From da67c6ee0bc243eb82be209ae3b84daa3a2e639b Mon Sep 17 00:00:00 2001 From: Chris Watson Date: Wed, 12 Jun 2024 01:11:12 +0000 Subject: [PATCH] bot api update --- src/tourmaline/client/api.cr | 165 +++++++++++++++++++++++------------ src/tourmaline/types/api.cr | 94 +++++++++++++++----- 2 files changed, 182 insertions(+), 77 deletions(-) diff --git a/src/tourmaline/client/api.cr b/src/tourmaline/client/api.cr index 70895d966..a1aee91ba 100644 --- a/src/tourmaline/client/api.cr +++ b/src/tourmaline/client/api.cr @@ -82,6 +82,7 @@ module Tourmaline link_preview_options : Tourmaline::LinkPreviewOptions | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -95,6 +96,7 @@ module Tourmaline link_preview_options: link_preview_options, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -199,25 +201,29 @@ module Tourmaline caption : String | ::Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | ::Nil = nil, + show_caption_above_media : Bool | ::Nil = nil, has_spoiler : Bool | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) request(Tourmaline::Message, "sendPhoto", { - chat_id: chat_id, - photo: photo, - business_connection_id: business_connection_id, - message_thread_id: message_thread_id, - caption: caption, - parse_mode: parse_mode, - caption_entities: caption_entities.try(&.to_json), - has_spoiler: has_spoiler, - disable_notification: disable_notification, - protect_content: protect_content, - reply_parameters: reply_parameters, - reply_markup: reply_markup.try(&.to_json), + chat_id: chat_id, + photo: photo, + business_connection_id: business_connection_id, + message_thread_id: message_thread_id, + caption: caption, + parse_mode: parse_mode, + caption_entities: caption_entities.try(&.to_json), + show_caption_above_media: show_caption_above_media, + has_spoiler: has_spoiler, + disable_notification: disable_notification, + protect_content: protect_content, + message_effect_id: message_effect_id, + reply_parameters: reply_parameters, + reply_markup: reply_markup.try(&.to_json), }) end @@ -237,6 +243,7 @@ module Tourmaline thumbnail : ::File | String | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -254,6 +261,7 @@ module Tourmaline thumbnail: thumbnail, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -272,6 +280,7 @@ module Tourmaline disable_content_type_detection : Bool | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -287,6 +296,7 @@ module Tourmaline disable_content_type_detection: disable_content_type_detection, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -305,31 +315,35 @@ module Tourmaline caption : String | ::Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | ::Nil = nil, + show_caption_above_media : Bool | ::Nil = nil, has_spoiler : Bool | ::Nil = nil, supports_streaming : Bool | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) request(Tourmaline::Message, "sendVideo", { - chat_id: chat_id, - video: video, - business_connection_id: business_connection_id, - message_thread_id: message_thread_id, - duration: duration, - width: width, - height: height, - thumbnail: thumbnail, - caption: caption, - parse_mode: parse_mode, - caption_entities: caption_entities.try(&.to_json), - has_spoiler: has_spoiler, - supports_streaming: supports_streaming, - disable_notification: disable_notification, - protect_content: protect_content, - reply_parameters: reply_parameters, - reply_markup: reply_markup.try(&.to_json), + chat_id: chat_id, + video: video, + business_connection_id: business_connection_id, + message_thread_id: message_thread_id, + duration: duration, + width: width, + height: height, + thumbnail: thumbnail, + caption: caption, + parse_mode: parse_mode, + caption_entities: caption_entities.try(&.to_json), + show_caption_above_media: show_caption_above_media, + has_spoiler: has_spoiler, + supports_streaming: supports_streaming, + disable_notification: disable_notification, + protect_content: protect_content, + message_effect_id: message_effect_id, + reply_parameters: reply_parameters, + reply_markup: reply_markup.try(&.to_json), }) end @@ -346,29 +360,33 @@ module Tourmaline caption : String | ::Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | ::Nil = nil, + show_caption_above_media : Bool | ::Nil = nil, has_spoiler : Bool | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) request(Tourmaline::Message, "sendAnimation", { - chat_id: chat_id, - animation: animation, - business_connection_id: business_connection_id, - message_thread_id: message_thread_id, - duration: duration, - width: width, - height: height, - thumbnail: thumbnail, - caption: caption, - parse_mode: parse_mode, - caption_entities: caption_entities.try(&.to_json), - has_spoiler: has_spoiler, - disable_notification: disable_notification, - protect_content: protect_content, - reply_parameters: reply_parameters, - reply_markup: reply_markup.try(&.to_json), + chat_id: chat_id, + animation: animation, + business_connection_id: business_connection_id, + message_thread_id: message_thread_id, + duration: duration, + width: width, + height: height, + thumbnail: thumbnail, + caption: caption, + parse_mode: parse_mode, + caption_entities: caption_entities.try(&.to_json), + show_caption_above_media: show_caption_above_media, + has_spoiler: has_spoiler, + disable_notification: disable_notification, + protect_content: protect_content, + message_effect_id: message_effect_id, + reply_parameters: reply_parameters, + reply_markup: reply_markup.try(&.to_json), }) end @@ -384,6 +402,7 @@ module Tourmaline duration : Int32 | Int64 | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -398,6 +417,7 @@ module Tourmaline duration: duration, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -414,6 +434,7 @@ module Tourmaline thumbnail : ::File | String | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -427,6 +448,7 @@ module Tourmaline thumbnail: thumbnail, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -440,6 +462,7 @@ module Tourmaline message_thread_id : Int32 | Int64 | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil ) request(Array(Tourmaline::Message), "sendMediaGroup", { @@ -449,6 +472,7 @@ module Tourmaline message_thread_id: message_thread_id, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, }) end @@ -466,6 +490,7 @@ module Tourmaline proximity_alert_radius : Int32 | Int64 | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -481,6 +506,7 @@ module Tourmaline proximity_alert_radius: proximity_alert_radius, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -501,6 +527,7 @@ module Tourmaline google_place_type : String | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -518,6 +545,7 @@ module Tourmaline google_place_type: google_place_type, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -534,6 +562,7 @@ module Tourmaline vcard : String | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -547,6 +576,7 @@ module Tourmaline vcard: vcard, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -573,6 +603,7 @@ module Tourmaline is_closed : Bool | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -596,6 +627,7 @@ module Tourmaline is_closed: is_closed, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -609,6 +641,7 @@ module Tourmaline emoji : String | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -619,6 +652,7 @@ module Tourmaline emoji: emoji, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -1370,16 +1404,18 @@ module Tourmaline caption : String | ::Nil = nil, parse_mode : ParseMode = default_parse_mode, caption_entities : Array(Tourmaline::MessageEntity) | ::Nil = nil, + show_caption_above_media : Bool | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil ) request(Tourmaline::Message | Bool, "editMessageCaption", { - chat_id: chat_id, - message_id: message_id, - inline_message_id: inline_message_id, - caption: caption, - parse_mode: parse_mode, - caption_entities: caption_entities.try(&.to_json), - reply_markup: reply_markup.try(&.to_json), + chat_id: chat_id, + message_id: message_id, + inline_message_id: inline_message_id, + caption: caption, + parse_mode: parse_mode, + caption_entities: caption_entities.try(&.to_json), + show_caption_above_media: show_caption_above_media, + reply_markup: reply_markup.try(&.to_json), }) end @@ -1510,6 +1546,7 @@ module Tourmaline emoji : String | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | Tourmaline::ReplyKeyboardMarkup | Tourmaline::ReplyKeyboardRemove | Tourmaline::ForceReply | ::Nil = nil ) @@ -1521,6 +1558,7 @@ module Tourmaline emoji: emoji, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -1740,10 +1778,10 @@ module Tourmaline title : String, description : String, payload : String, - provider_token : String, currency : String, prices : Array(Tourmaline::LabeledPrice), message_thread_id : Int32 | Int64 | ::Nil = nil, + provider_token : String | ::Nil = nil, max_tip_amount : Int32 | Int64 | ::Nil = nil, suggested_tip_amounts : Array(Int32 | Int64) | ::Nil = nil, start_parameter : String | ::Nil = nil, @@ -1761,6 +1799,7 @@ module Tourmaline is_flexible : Bool | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil ) @@ -1769,10 +1808,10 @@ module Tourmaline title: title, description: description, payload: payload, - provider_token: provider_token, currency: currency, prices: prices.to_json, message_thread_id: message_thread_id, + provider_token: provider_token, max_tip_amount: max_tip_amount, suggested_tip_amounts: suggested_tip_amounts.try(&.to_json), start_parameter: start_parameter, @@ -1790,6 +1829,7 @@ module Tourmaline is_flexible: is_flexible, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) @@ -1800,9 +1840,9 @@ module Tourmaline title : String, description : String, payload : String, - provider_token : String, currency : String, prices : Array(Tourmaline::LabeledPrice), + provider_token : String | ::Nil = nil, max_tip_amount : Int32 | Int64 | ::Nil = nil, suggested_tip_amounts : Array(Int32 | Int64) | ::Nil = nil, provider_data : String | ::Nil = nil, @@ -1822,9 +1862,9 @@ module Tourmaline title: title, description: description, payload: payload, - provider_token: provider_token, currency: currency, prices: prices.to_json, + provider_token: provider_token, max_tip_amount: max_tip_amount, suggested_tip_amounts: suggested_tip_amounts.try(&.to_json), provider_data: provider_data.try(&.to_json), @@ -1870,6 +1910,17 @@ module Tourmaline }) end + # Refunds a successful payment in Telegram Stars. Returns True on success. + def refund_star_payment( + user_id : Int32 | Int64, + telegram_payment_charge_id : String + ) + request(Bool, "refundStarPayment", { + user_id: user_id, + telegram_payment_charge_id: telegram_payment_charge_id, + }) + end + # Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. # Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. def set_passport_data_errors( @@ -1890,6 +1941,7 @@ module Tourmaline message_thread_id : Int32 | Int64 | ::Nil = nil, disable_notification : Bool | ::Nil = nil, protect_content : Bool | ::Nil = nil, + message_effect_id : String | ::Nil = nil, reply_parameters : Tourmaline::ReplyParameters | ::Nil = nil, reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil ) @@ -1900,6 +1952,7 @@ module Tourmaline message_thread_id: message_thread_id, disable_notification: disable_notification, protect_content: protect_content, + message_effect_id: message_effect_id, reply_parameters: reply_parameters, reply_markup: reply_markup.try(&.to_json), }) diff --git a/src/tourmaline/types/api.cr b/src/tourmaline/types/api.cr index fd0593e49..c55602e8d 100644 --- a/src/tourmaline/types/api.cr +++ b/src/tourmaline/types/api.cr @@ -510,6 +510,9 @@ module Tourmaline # Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed property link_preview_options : Tourmaline::LinkPreviewOptions | ::Nil + # Optional. Unique identifier of the message effect added to the message + property effect_id : String | ::Nil + # Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set property animation : Tourmaline::Animation | ::Nil @@ -543,6 +546,9 @@ module Tourmaline # Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. True, if the message media is covered by a spoiler animation property? has_media_spoiler : Bool | ::Nil @@ -704,6 +710,7 @@ module Tourmaline @text : String | ::Nil = nil, @entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, @link_preview_options : Tourmaline::LinkPreviewOptions | ::Nil = nil, + @effect_id : String | ::Nil = nil, @animation : Tourmaline::Animation | ::Nil = nil, @audio : Tourmaline::Audio | ::Nil = nil, @document : Tourmaline::Document | ::Nil = nil, @@ -715,6 +722,7 @@ module Tourmaline @voice : Tourmaline::Voice | ::Nil = nil, @caption : String | ::Nil = nil, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @has_media_spoiler : Bool | ::Nil = nil, @contact : Tourmaline::Contact | ::Nil = nil, @dice : Tourmaline::Dice | ::Nil = nil, @@ -808,7 +816,7 @@ module Tourmaline class MessageEntity include JSON::Serializable - # Type of the entity. Currently, can be "mention" (@username), "hashtag" (#hashtag), "cashtag" ($USD), "bot_command" (/start@jobs_bot), "url" (https://telegram.org), "email" (do-not-reply@telegram.org), "phone_number" (+1-212-555-0123), "bold" (bold text), "italic" (italic text), "underline" (underlined text), "strikethrough" (strikethrough text), "spoiler" (spoiler message), "blockquote" (block quotation), "code" (monowidth string), "pre" (monowidth block), "text_link" (for clickable text URLs), "text_mention" (for users without usernames), "custom_emoji" (for inline custom emoji stickers) + # Type of the entity. Currently, can be "mention" (@username), "hashtag" (#hashtag), "cashtag" ($USD), "bot_command" (/start@jobs_bot), "url" (https://telegram.org), "email" (do-not-reply@telegram.org), "phone_number" (+1-212-555-0123), "bold" (bold text), "italic" (italic text), "underline" (underlined text), "strikethrough" (strikethrough text), "spoiler" (spoiler message), "blockquote" (block quotation), "expandable_blockquote" (collapsed-by-default block quotation), "code" (monowidth string), "pre" (monowidth block), "text_link" (for clickable text URLs), "text_mention" (for users without usernames), "custom_emoji" (for inline custom emoji stickers) property type : String # Offset in UTF-16 code units to the start of the entity @@ -2324,7 +2332,7 @@ module Tourmaline end end - # This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_users, request_chat, request_contact, request_location, and request_poll are mutually exclusive. + # This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text. # Note: request_users and request_chat options will only work in Telegram versions released after 3 February, 2023. Older clients will display unsupported message. class KeyboardButton include JSON::Serializable @@ -2495,7 +2503,7 @@ module Tourmaline end end - # This object represents one button of an inline keyboard. You must use exactly one of the optional fields. + # This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button. class InlineKeyboardButton include JSON::Serializable @@ -2526,7 +2534,7 @@ module Tourmaline # Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row. property callback_game : Tourmaline::CallbackGame | ::Nil - # Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. + # Optional. Specify True, to send a Pay button. Substrings "⭐" and "XTR" in the buttons's text will be replaced with a Telegram Star icon. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. property? pay : Bool | ::Nil def initialize( @@ -3924,6 +3932,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Pass True if the photo needs to be covered with a spoiler animation property? has_spoiler : Bool | ::Nil @@ -3933,6 +3944,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @has_spoiler : Bool | ::Nil = nil ) end @@ -3960,6 +3972,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Video width property width : Int32 | Int64 | ::Nil @@ -3982,6 +3997,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @width : Int32 | Int64 | ::Nil = nil, @height : Int32 | Int64 | ::Nil = nil, @duration : Int32 | Int64 | ::Nil = nil, @@ -4013,6 +4029,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Animation width property width : Int32 | Int64 | ::Nil @@ -4032,6 +4051,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @width : Int32 | Int64 | ::Nil = nil, @height : Int32 | Int64 | ::Nil = nil, @duration : Int32 | Int64 | ::Nil = nil, @@ -4447,6 +4467,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Inline keyboard attached to the message property reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil @@ -4465,6 +4488,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil, @input_message_content : Tourmaline::InputMessageContent | ::Nil = nil ) @@ -4511,6 +4535,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Inline keyboard attached to the message property reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil @@ -4530,6 +4557,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil, @input_message_content : Tourmaline::InputMessageContent | ::Nil = nil ) @@ -4576,6 +4604,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Inline keyboard attached to the message property reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil @@ -4595,6 +4626,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil, @input_message_content : Tourmaline::InputMessageContent | ::Nil = nil ) @@ -4632,6 +4664,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Video width property video_width : Int32 | Int64 | ::Nil @@ -4660,6 +4695,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @video_width : Int32 | Int64 | ::Nil = nil, @video_height : Int32 | Int64 | ::Nil = nil, @video_duration : Int32 | Int64 | ::Nil = nil, @@ -5077,6 +5113,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Inline keyboard attached to the message property reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil @@ -5092,6 +5131,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil, @input_message_content : Tourmaline::InputMessageContent | ::Nil = nil ) @@ -5123,6 +5163,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Inline keyboard attached to the message property reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil @@ -5137,6 +5180,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil, @input_message_content : Tourmaline::InputMessageContent | ::Nil = nil ) @@ -5168,6 +5212,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Inline keyboard attached to the message property reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil @@ -5182,6 +5229,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil, @input_message_content : Tourmaline::InputMessageContent | ::Nil = nil ) @@ -5294,6 +5342,9 @@ module Tourmaline # Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode property caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity + # Optional. Pass True, if the caption must be shown above the message media + property? show_caption_above_media : Bool | ::Nil + # Optional. Inline keyboard attached to the message property reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil @@ -5309,6 +5360,7 @@ module Tourmaline @caption : String | ::Nil = nil, @parse_mode : ParseMode = ParseMode::Markdown, @caption_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, + @show_caption_above_media : Bool | ::Nil = nil, @reply_markup : Tourmaline::InlineKeyboardMarkup | ::Nil = nil, @input_message_content : Tourmaline::InputMessageContent | ::Nil = nil ) @@ -5546,16 +5598,16 @@ module Tourmaline # Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. property payload : String - # Payment provider token, obtained via @BotFather - property provider_token : String - - # Three-letter ISO 4217 currency code, see more on currencies + # Three-letter ISO 4217 currency code, see more on currencies. Pass "XTR" for payments in Telegram Stars. property currency : String - # Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + # Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. property prices : Array(Tourmaline::LabeledPrice) = [] of Tourmaline::LabeledPrice - # Optional. 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 + # Optional. Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. + property provider_token : String | ::Nil + + # Optional. 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. Not supported for payments in Telegram Stars. property max_tip_amount : Int32 | Int64 | ::Nil # Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. @@ -5576,34 +5628,34 @@ module Tourmaline # Optional. Photo height property photo_height : Int32 | Int64 | ::Nil - # Optional. Pass True if you require the user's full name to complete the order + # Optional. Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. property? need_name : Bool | ::Nil - # Optional. Pass True if you require the user's phone number to complete the order + # Optional. Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. property? need_phone_number : Bool | ::Nil - # Optional. Pass True if you require the user's email address to complete the order + # Optional. Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. property? need_email : Bool | ::Nil - # Optional. Pass True if you require the user's shipping address to complete the order + # Optional. Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. property? need_shipping_address : Bool | ::Nil - # Optional. Pass True if the user's phone number should be sent to provider + # Optional. Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. property? send_phone_number_to_provider : Bool | ::Nil - # Optional. Pass True if the user's email address should be sent to provider + # Optional. Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. property? send_email_to_provider : Bool | ::Nil - # Optional. Pass True if the final price depends on the shipping method + # Optional. Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. property? is_flexible : Bool | ::Nil def initialize( @title, @description, @payload, - @provider_token, @currency, @prices : Array(Tourmaline::LabeledPrice) = [] of Tourmaline::LabeledPrice, + @provider_token : String | ::Nil = nil, @max_tip_amount : Int32 | Int64 | ::Nil = nil, @suggested_tip_amounts : Array(Int32 | Int64) = [] of Int32 | Int64, @provider_data : String | ::Nil = nil, @@ -5695,7 +5747,7 @@ module Tourmaline # Unique bot deep-linking parameter that can be used to generate this invoice property start_parameter : String - # Three-letter ISO 4217 currency code + # Three-letter ISO 4217 currency code, or "XTR" for payments in Telegram Stars property currency : String # Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass 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). @@ -5794,7 +5846,7 @@ module Tourmaline class SuccessfulPayment include JSON::Serializable - # Three-letter ISO 4217 currency code + # Three-letter ISO 4217 currency code, or "XTR" for payments in Telegram Stars property currency : String # Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass 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). @@ -5862,7 +5914,7 @@ module Tourmaline # User who sent the query property from : Tourmaline::User - # Three-letter ISO 4217 currency code + # Three-letter ISO 4217 currency code, or "XTR" for payments in Telegram Stars property currency : String # Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass 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).