From 098a51862b3d917e7e4bb924db107525ed327634 Mon Sep 17 00:00:00 2001 From: Chris Watson Date: Sat, 14 Sep 2024 01:18:15 +0000 Subject: [PATCH] bot api update --- src/tourmaline/client/api.cr | 191 +++++++++++------ src/tourmaline/types/api.cr | 388 +++++++++++++++++++++++++++++------ 2 files changed, 462 insertions(+), 117 deletions(-) diff --git a/src/tourmaline/client/api.cr b/src/tourmaline/client/api.cr index d3dbaef73..670fc47b5 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), }) @@ -138,7 +140,7 @@ module Tourmaline }) end - # Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. + # Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. def copy_message( chat_id : Int32 | Int64 | String, from_chat_id : Int32 | Int64 | String, @@ -167,7 +169,7 @@ module Tourmaline }) end - # Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned. + # Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned. def copy_messages( chat_id : Int32 | Int64 | String, from_chat_id : Int32 | Int64 | String, @@ -197,25 +199,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 @@ -235,6 +241,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 ) @@ -252,6 +259,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), }) @@ -270,6 +278,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 ) @@ -285,6 +294,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), }) @@ -303,31 +313,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 @@ -344,29 +358,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 @@ -382,6 +400,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 ) @@ -396,6 +415,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), }) @@ -412,6 +432,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 ) @@ -425,6 +446,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), }) @@ -438,6 +460,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", { @@ -447,6 +470,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 @@ -464,6 +488,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 ) @@ -479,6 +504,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), }) @@ -499,6 +525,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 ) @@ -516,6 +543,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), }) @@ -532,6 +560,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 ) @@ -545,6 +574,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), }) @@ -571,6 +601,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 ) @@ -594,6 +625,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), }) @@ -607,6 +639,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 ) @@ -617,6 +650,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), }) @@ -638,7 +672,7 @@ module Tourmaline }) end - # Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns True on success. + # Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success. def set_message_reaction( chat_id : Int32 | Int64 | String, message_id : Int32 | Int64, @@ -855,6 +889,34 @@ module Tourmaline }) end + # Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object. + def create_chat_subscription_invite_link( + chat_id : Int32 | Int64 | String, + subscription_period : Int32 | Int64, + subscription_price : Int32 | Int64, + name : String | ::Nil = nil + ) + request(Tourmaline::ChatInviteLink, "createChatSubscriptionInviteLink", { + chat_id: chat_id, + subscription_period: subscription_period, + subscription_price: subscription_price, + name: name, + }) + end + + # Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object. + def edit_chat_subscription_invite_link( + chat_id : Int32 | Int64 | String, + invite_link : String, + name : String | ::Nil = nil + ) + request(Tourmaline::ChatInviteLink, "editChatSubscriptionInviteLink", { + chat_id: chat_id, + invite_link: invite_link, + name: name, + }) + end + # Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object. def revoke_chat_invite_link( chat_id : Int32 | Int64 | String, @@ -934,23 +996,27 @@ module Tourmaline def pin_chat_message( chat_id : Int32 | Int64 | String, message_id : Int32 | Int64, + business_connection_id : String | ::Nil = nil, disable_notification : Bool | ::Nil = nil ) request(Bool, "pinChatMessage", { - chat_id: chat_id, - message_id: message_id, - disable_notification: disable_notification, + chat_id: chat_id, + message_id: message_id, + business_connection_id: business_connection_id, + disable_notification: disable_notification, }) end # Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success. def unpin_chat_message( chat_id : Int32 | Int64 | String, + business_connection_id : String | ::Nil = nil, message_id : Int32 | Int64 | ::Nil = nil ) request(Bool, "unpinChatMessage", { - chat_id: chat_id, - message_id: message_id, + chat_id: chat_id, + business_connection_id: business_connection_id, + message_id: message_id, }) end @@ -1050,7 +1116,7 @@ module Tourmaline }) end - # Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. + # Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. def edit_forum_topic( chat_id : Int32 | Int64 | String, message_thread_id : Int32 | Int64, @@ -1109,7 +1175,7 @@ module Tourmaline }) end - # Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success. + # Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. def edit_general_forum_topic( chat_id : Int32 | Int64 | String, name : String @@ -1368,6 +1434,7 @@ 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", { @@ -1508,6 +1575,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 ) @@ -1519,6 +1587,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), }) @@ -1738,10 +1807,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, @@ -1759,6 +1828,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 ) @@ -1767,10 +1837,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, @@ -1788,6 +1858,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), }) @@ -1798,9 +1869,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, @@ -1820,9 +1891,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), @@ -1888,6 +1959,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 ) @@ -1898,6 +1970,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 d3585ab22..a39e17fe3 100644 --- a/src/tourmaline/types/api.cr +++ b/src/tourmaline/types/api.cr @@ -192,6 +192,9 @@ module Tourmaline # Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe. property? can_connect_to_business : Bool | ::Nil + # Optional. True, if the bot has a main Web App. Returned only in getMe. + property? has_main_web_app : Bool | ::Nil + def initialize( @id, @is_bot, @@ -204,7 +207,8 @@ module Tourmaline @can_join_groups : Bool | ::Nil = nil, @can_read_all_group_messages : Bool | ::Nil = nil, @supports_inline_queries : Bool | ::Nil = nil, - @can_connect_to_business : Bool | ::Nil = nil + @can_connect_to_business : Bool | ::Nil = nil, + @has_main_web_app : Bool | ::Nil = nil ) end end @@ -344,6 +348,9 @@ module Tourmaline # Optional. Default chat member permissions, for groups and supergroups property permissions : Tourmaline::ChatPermissions | ::Nil + # Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. + property? can_send_paid_media : Bool | ::Nil + # Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds property slow_mode_delay : Int32 | Int64 | ::Nil @@ -413,6 +420,7 @@ module Tourmaline @invite_link : String | ::Nil = nil, @pinned_message : Tourmaline::Message | ::Nil = nil, @permissions : Tourmaline::ChatPermissions | ::Nil = nil, + @can_send_paid_media : Bool | ::Nil = nil, @slow_mode_delay : Int32 | Int64 | ::Nil = nil, @unrestrict_boost_count : Int32 | Int64 | ::Nil = nil, @message_auto_delete_time : Int32 | Int64 | ::Nil = nil, @@ -446,10 +454,10 @@ module Tourmaline # Optional. Unique identifier of a message thread to which the message belongs; for supergroups only property message_thread_id : Int32 | Int64 | ::Nil - # 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. + # Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats property from : Tourmaline::User | ::Nil - # 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. + # Optional. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats. property sender_chat : Tourmaline::Chat | ::Nil # Optional. If the sender of the message boosted the chat, the number of boosts added by the user @@ -510,6 +518,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 @@ -519,6 +530,9 @@ module Tourmaline # Optional. Message is a general file, information about the file property document : Tourmaline::Document | ::Nil + # Optional. Message contains paid media; information about the paid media + property paid_media : Tourmaline::PaidMediaInfo | ::Nil + # Optional. Message is a photo, available sizes of the photo property photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize @@ -537,12 +551,15 @@ module Tourmaline # Optional. Message is a voice message, information about the file property voice : Tourmaline::Voice | ::Nil - # Optional. Caption for the animation, audio, document, photo, video or voice + # Optional. Caption for the animation, audio, document, paid media, photo, video or voice property caption : String | ::Nil # 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 @@ -606,6 +623,9 @@ module Tourmaline # Optional. Message is a service message about a successful payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments property successful_payment : Tourmaline::SuccessfulPayment | ::Nil + # Optional. Message is a service message about a refunded payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments + property refunded_payment : Tourmaline::RefundedPayment | ::Nil + # Optional. Service message: users were shared with the bot property users_shared : Tourmaline::UsersShared | ::Nil @@ -704,9 +724,11 @@ 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, + @paid_media : Tourmaline::PaidMediaInfo | ::Nil = nil, @photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize, @sticker : Tourmaline::Sticker | ::Nil = nil, @story : Tourmaline::Story | ::Nil = nil, @@ -715,6 +737,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, @@ -736,6 +759,7 @@ module Tourmaline @pinned_message : Tourmaline::MaybeInaccessibleMessage | ::Nil = nil, @invoice : Tourmaline::Invoice | ::Nil = nil, @successful_payment : Tourmaline::SuccessfulPayment | ::Nil = nil, + @refunded_payment : Tourmaline::RefundedPayment | ::Nil = nil, @users_shared : Tourmaline::UsersShared | ::Nil = nil, @chat_shared : Tourmaline::ChatShared | ::Nil = nil, @connected_website : String | ::Nil = nil, @@ -808,7 +832,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 @@ -891,6 +915,9 @@ module Tourmaline # Optional. Message is a general file, information about the file property document : Tourmaline::Document | ::Nil + # Optional. Message contains paid media; information about the paid media + property paid_media : Tourmaline::PaidMediaInfo | ::Nil + # Optional. Message is a photo, available sizes of the photo property photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize @@ -947,6 +974,7 @@ module Tourmaline @animation : Tourmaline::Animation | ::Nil = nil, @audio : Tourmaline::Audio | ::Nil = nil, @document : Tourmaline::Document | ::Nil = nil, + @paid_media : Tourmaline::PaidMediaInfo | ::Nil = nil, @photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize, @sticker : Tourmaline::Sticker | ::Nil = nil, @story : Tourmaline::Story | ::Nil = nil, @@ -1150,22 +1178,22 @@ module Tourmaline # Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. property file_unique_id : String - # Video width as defined by sender + # Video width as defined by the sender property width : Int32 | Int64 - # Video height as defined by sender + # Video height as defined by the sender property height : Int32 | Int64 - # Duration of the video in seconds as defined by sender + # Duration of the video in seconds as defined by the sender property duration : Int32 | Int64 - # Optional. Animation thumbnail as defined by sender + # Optional. Animation thumbnail as defined by the sender property thumbnail : Tourmaline::PhotoSize | ::Nil - # Optional. Original animation filename as defined by sender + # Optional. Original animation filename as defined by the sender property file_name : String | ::Nil - # Optional. MIME type of the file as defined by sender + # Optional. MIME type of the file as defined by the sender property mime_type : String | ::Nil # Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. @@ -1195,19 +1223,19 @@ module Tourmaline # Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. property file_unique_id : String - # Duration of the audio in seconds as defined by sender + # Duration of the audio in seconds as defined by the sender property duration : Int32 | Int64 - # Optional. Performer of the audio as defined by sender or by audio tags + # Optional. Performer of the audio as defined by the sender or by audio tags property performer : String | ::Nil - # Optional. Title of the audio as defined by sender or by audio tags + # Optional. Title of the audio as defined by the sender or by audio tags property title : String | ::Nil - # Optional. Original filename as defined by sender + # Optional. Original filename as defined by the sender property file_name : String | ::Nil - # Optional. MIME type of the file as defined by sender + # Optional. MIME type of the file as defined by the sender property mime_type : String | ::Nil # Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. @@ -1240,13 +1268,13 @@ module Tourmaline # Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. property file_unique_id : String - # Optional. Document thumbnail as defined by sender + # Optional. Document thumbnail as defined by the sender property thumbnail : Tourmaline::PhotoSize | ::Nil - # Optional. Original filename as defined by sender + # Optional. Original filename as defined by the sender property file_name : String | ::Nil - # Optional. MIME type of the file as defined by sender + # Optional. MIME type of the file as defined by the sender property mime_type : String | ::Nil # Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. @@ -1290,22 +1318,22 @@ module Tourmaline # Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. property file_unique_id : String - # Video width as defined by sender + # Video width as defined by the sender property width : Int32 | Int64 - # Video height as defined by sender + # Video height as defined by the sender property height : Int32 | Int64 - # Duration of the video in seconds as defined by sender + # Duration of the video in seconds as defined by the sender property duration : Int32 | Int64 # Optional. Video thumbnail property thumbnail : Tourmaline::PhotoSize | ::Nil - # Optional. Original filename as defined by sender + # Optional. Original filename as defined by the sender property file_name : String | ::Nil - # Optional. MIME type of the file as defined by sender + # Optional. MIME type of the file as defined by the sender property mime_type : String | ::Nil # Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. @@ -1335,10 +1363,10 @@ module Tourmaline # Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. property file_unique_id : String - # Video width and height (diameter of the video message) as defined by sender + # Video width and height (diameter of the video message) as defined by the sender property length : Int32 | Int64 - # Duration of the video in seconds as defined by sender + # Duration of the video in seconds as defined by the sender property duration : Int32 | Int64 # Optional. Video thumbnail @@ -1368,10 +1396,10 @@ module Tourmaline # Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. property file_unique_id : String - # Duration of the audio in seconds as defined by sender + # Duration of the audio in seconds as defined by the sender property duration : Int32 | Int64 - # Optional. MIME type of the file as defined by sender + # Optional. MIME type of the file as defined by the sender property mime_type : String | ::Nil # Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. @@ -1387,6 +1415,88 @@ module Tourmaline end end + # Describes the paid media added to a message. + class PaidMediaInfo + include JSON::Serializable + + # The number of Telegram Stars that must be paid to buy access to the media + property star_count : Int32 | Int64 + + # Information about the paid media + property paid_media : Array(Tourmaline::PaidMedia) = [] of Tourmaline::PaidMedia + + def initialize( + @star_count, + @paid_media : Array(Tourmaline::PaidMedia) = [] of Tourmaline::PaidMedia + ) + end + end + + # This object describes paid media. Currently, it can be one of + # - PaidMediaPreview + # - PaidMediaPhoto + # - PaidMediaVideo + alias PaidMedia = Tourmaline::PaidMediaPreview | Tourmaline::PaidMediaPhoto | Tourmaline::PaidMediaVideo + + # The paid media isn't available before the payment. + class PaidMediaPreview + include JSON::Serializable + + # Type of the paid media, always "preview" + property type : String + + # Optional. Media width as defined by the sender + property width : Int32 | Int64 | ::Nil + + # Optional. Media height as defined by the sender + property height : Int32 | Int64 | ::Nil + + # Optional. Duration of the media in seconds as defined by the sender + property duration : Int32 | Int64 | ::Nil + + def initialize( + @type, + @width : Int32 | Int64 | ::Nil = nil, + @height : Int32 | Int64 | ::Nil = nil, + @duration : Int32 | Int64 | ::Nil = nil + ) + end + end + + # The paid media is a photo. + class PaidMediaPhoto + include JSON::Serializable + + # Type of the paid media, always "photo" + property type : String + + # The photo + property photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize + + def initialize( + @type, + @photo : Array(Tourmaline::PhotoSize) = [] of Tourmaline::PhotoSize + ) + end + end + + # The paid media is a video. + class PaidMediaVideo + include JSON::Serializable + + # Type of the paid media, always "video" + property type : String + + # The video + property video : Tourmaline::Video + + def initialize( + @type, + @video + ) + end + end + # This object represents a phone contact. class Contact include JSON::Serializable @@ -1454,7 +1564,7 @@ module Tourmaline end end - # This object contains information about one answer option in a poll to send. + # This object contains information about one answer option in a poll to be sent. class InputPollOption include JSON::Serializable @@ -1570,7 +1680,10 @@ module Tourmaline class Location include JSON::Serializable - # Longitude as defined by sender + # Latitude as defined by the sender + property latitude : Float64 + + # Longitude as defined by the sender property longitude : Float64 # Latitude as defined by sender @@ -2324,7 +2437,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 +2608,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 +2639,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( @@ -2714,6 +2827,12 @@ module Tourmaline # Optional. Number of pending join requests created using this link property pending_join_request_count : Int32 | Int64 | ::Nil + # Optional. The number of seconds the subscription will be active for before the next payment + property subscription_period : Int32 | Int64 | ::Nil + + # Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link + property subscription_price : Int32 | Int64 | ::Nil + def initialize( @invite_link, @creator, @@ -2723,7 +2842,9 @@ module Tourmaline @name : String | ::Nil = nil, @expire_date : Int32 | Int64 | ::Nil = nil, @member_limit : Int32 | Int64 | ::Nil = nil, - @pending_join_request_count : Int32 | Int64 | ::Nil = nil + @pending_join_request_count : Int32 | Int64 | ::Nil = nil, + @subscription_period : Int32 | Int64 | ::Nil = nil, + @subscription_price : Int32 | Int64 | ::Nil = nil ) end end @@ -2968,9 +3089,14 @@ module Tourmaline # Information about the user property user : Tourmaline::User + # Optional. Date when the user's subscription will expire; Unix time + @[JSON::Field(converter: Time::EpochConverter)] + property until_date : Time | ::Nil + def initialize( @status, - @user + @user, + @until_date : Int32 | Int64 | ::Nil = nil ) end end @@ -3308,7 +3434,8 @@ module Tourmaline # This object describes the type of a reaction. Currently, it can be one of # - ReactionTypeEmoji # - ReactionTypeCustomEmoji - alias ReactionType = Tourmaline::ReactionTypeEmoji | Tourmaline::ReactionTypeCustomEmoji + # - ReactionTypePaid + alias ReactionType = Tourmaline::ReactionTypeEmoji | Tourmaline::ReactionTypeCustomEmoji | Tourmaline::ReactionTypePaid # The reaction is based on an emoji. class ReactionTypeEmoji @@ -3344,6 +3471,19 @@ module Tourmaline end end + # The reaction is paid. + class ReactionTypePaid + include JSON::Serializable + + # Type of the reaction, always "paid" + property type : String + + def initialize( + @type + ) + end + end + # Represents a reaction added to a message along with the number of times it was added. class ReactionCount include JSON::Serializable @@ -3653,7 +3793,7 @@ module Tourmaline # Text on the button property text : String - # Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. + # Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. property web_app : Tourmaline::WebAppInfo def initialize( @@ -3924,6 +4064,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 +4076,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 +4104,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 +4129,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 +4161,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 +4183,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, @@ -4127,6 +4279,65 @@ module Tourmaline include JSON::Serializable end + # This object describes the paid media to be sent. Currently, it can be one of + # - InputPaidMediaPhoto + # - InputPaidMediaVideo + alias InputPaidMedia = Tourmaline::InputPaidMediaPhoto | Tourmaline::InputPaidMediaVideo + + # The paid media to send is a photo. + class InputPaidMediaPhoto + include JSON::Serializable + + # Type of the media, must be photo + property type : String + + # File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name. More information on Sending Files: https://core.telegram.org/bots/api#sending-files + property media : String + + def initialize( + @type, + @media + ) + end + end + + # The paid media to send is a video. + class InputPaidMediaVideo + include JSON::Serializable + + # Type of the media, must be video + property type : String + + # File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name. More information on Sending Files: https://core.telegram.org/bots/api#sending-files + property media : String + + # Optional. 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 information on Sending Files: https://core.telegram.org/bots/api#sending-files + property thumbnail : ::File | String | ::Nil + + # Optional. Video width + property width : Int32 | Int64 | ::Nil + + # Optional. Video height + property height : Int32 | Int64 | ::Nil + + # Optional. Video duration in seconds + property duration : Int32 | Int64 | ::Nil + + # Optional. Pass True if the uploaded video is suitable for streaming + property? supports_streaming : Bool | ::Nil + + def initialize( + @type, + @media, + @thumbnail : ::File | String | ::Nil = nil, + @width : Int32 | Int64 | ::Nil = nil, + @height : Int32 | Int64 | ::Nil = nil, + @duration : Int32 | Int64 | ::Nil = nil, + @supports_streaming : Bool | ::Nil = nil + ) + end + end + # This object represents a sticker. class Sticker include JSON::Serializable @@ -4447,6 +4658,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 +4679,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 +4726,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 +4748,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 +4795,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 +4817,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 +4855,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 +4886,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 +5304,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 +5322,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 +5354,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 +5371,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 +5403,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 +5420,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 +5533,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 +5551,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 ) @@ -5543,19 +5786,19 @@ module Tourmaline # Product description, 1-255 characters property description : String - # Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. + # Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it 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 +5819,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 +5938,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,13 +6037,13 @@ 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). property total_amount : Int32 | Int64 - # Bot specified invoice payload + # Bot-specified invoice payload property invoice_payload : String # Telegram payment identifier @@ -5827,6 +6070,35 @@ module Tourmaline end end + # This object contains basic information about a refunded payment. + class RefundedPayment + include JSON::Serializable + + # Three-letter ISO 4217 currency code, or "XTR" for payments in Telegram Stars. Currently, always "XTR" + property currency : String + + # Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_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). + property total_amount : Int32 | Int64 + + # Bot-specified invoice payload + property invoice_payload : String + + # Telegram payment identifier + property telegram_payment_charge_id : String + + # Optional. Provider payment identifier + property provider_payment_charge_id : String | ::Nil + + def initialize( + @currency, + @total_amount, + @invoice_payload, + @telegram_payment_charge_id, + @provider_payment_charge_id : String | ::Nil = nil + ) + end + end + # This object contains information about an incoming shipping query. class ShippingQuery include JSON::Serializable @@ -5837,7 +6109,7 @@ module Tourmaline # User who sent the query property from : Tourmaline::User - # Bot specified invoice payload + # Bot-specified invoice payload property invoice_payload : String # User specified shipping address @@ -5862,13 +6134,13 @@ 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). property total_amount : Int32 | Int64 - # Bot specified invoice payload + # Bot-specified invoice payload property invoice_payload : String # Optional. Identifier of the shipping option chosen by the user