From 5c778e9303cec0328532d29f157abb633ca41bbc Mon Sep 17 00:00:00 2001 From: Alexander Tipugin Date: Thu, 13 Feb 2025 07:33:04 +0300 Subject: [PATCH] Implement Bot API 8.3 (#323) --- data/type_attributes.json | 39 +++++++++++++++++++ lib/telegram/bot/types/chat_full_info.rb | 1 + lib/telegram/bot/types/input_media_video.rb | 2 + .../bot/types/input_paid_media_video.rb | 2 + lib/telegram/bot/types/transaction_partner.rb | 1 + .../bot/types/transaction_partner_chat.rb | 13 +++++++ lib/telegram/bot/types/video.rb | 2 + 7 files changed, 60 insertions(+) create mode 100644 lib/telegram/bot/types/transaction_partner_chat.rb diff --git a/data/type_attributes.json b/data/type_attributes.json index 409f9e4..7fd5d75 100644 --- a/data/type_attributes.json +++ b/data/type_attributes.json @@ -301,6 +301,10 @@ "permissions": { "type": "ChatPermissions" }, + "can_send_gift": { + "type": "boolean", + "default": true + }, "can_send_paid_media": { "type": "boolean", "default": true @@ -1023,6 +1027,13 @@ "thumbnail": { "type": "PhotoSize" }, + "cover": { + "type": "array", + "items": "PhotoSize" + }, + "start_timestamp": { + "type": "integer" + }, "file_name": { "type": "string" }, @@ -3016,6 +3027,12 @@ "thumbnail": { "type": "string" }, + "cover": { + "type": "string" + }, + "start_timestamp": { + "type": "integer" + }, "caption": { "type": "string", "max_size": 1024 @@ -3183,6 +3200,12 @@ "thumbnail": { "type": "string" }, + "cover": { + "type": "string" + }, + "start_timestamp": { + "type": "integer" + }, "width": { "type": "integer" }, @@ -4734,6 +4757,7 @@ "TransactionPartner": { "type": [ "TransactionPartnerUser", + "TransactionPartnerChat", "TransactionPartnerAffiliateProgram", "TransactionPartnerFragment", "TransactionPartnerTelegramAds", @@ -4772,6 +4796,21 @@ "type": "Gift" } }, + "TransactionPartnerChat": { + "type": { + "type": "string", + "required": true, + "required_value": "chat", + "default": "chat" + }, + "chat": { + "type": "Chat", + "required": true + }, + "gift": { + "type": "Gift" + } + }, "TransactionPartnerAffiliateProgram": { "type": { "type": "string", diff --git a/lib/telegram/bot/types/chat_full_info.rb b/lib/telegram/bot/types/chat_full_info.rb index 07d54b2..2b11407 100644 --- a/lib/telegram/bot/types/chat_full_info.rb +++ b/lib/telegram/bot/types/chat_full_info.rb @@ -35,6 +35,7 @@ class ChatFullInfo < Base attribute? :invite_link, Types::String attribute? :pinned_message, Message attribute? :permissions, ChatPermissions + attribute? :can_send_gift, Types::True attribute? :can_send_paid_media, Types::True attribute? :slow_mode_delay, Types::Integer attribute? :unrestrict_boost_count, Types::Integer diff --git a/lib/telegram/bot/types/input_media_video.rb b/lib/telegram/bot/types/input_media_video.rb index 594d333..0d91c54 100644 --- a/lib/telegram/bot/types/input_media_video.rb +++ b/lib/telegram/bot/types/input_media_video.rb @@ -7,6 +7,8 @@ class InputMediaVideo < Base attribute :type, Types::String.constrained(eql: 'video').default('video') attribute :media, Types::String attribute? :thumbnail, Types::String + attribute? :cover, Types::String + attribute? :start_timestamp, Types::Integer attribute? :caption, Types::String attribute? :parse_mode, Types::String attribute? :caption_entities, Types::Array.of(MessageEntity) diff --git a/lib/telegram/bot/types/input_paid_media_video.rb b/lib/telegram/bot/types/input_paid_media_video.rb index bf50aaa..eed8c52 100644 --- a/lib/telegram/bot/types/input_paid_media_video.rb +++ b/lib/telegram/bot/types/input_paid_media_video.rb @@ -7,6 +7,8 @@ class InputPaidMediaVideo < Base attribute :type, Types::String.constrained(eql: 'video').default('video') attribute :media, Types::String attribute? :thumbnail, Types::String + attribute? :cover, Types::String + attribute? :start_timestamp, Types::Integer attribute? :width, Types::Integer attribute? :height, Types::Integer attribute? :duration, Types::Integer diff --git a/lib/telegram/bot/types/transaction_partner.rb b/lib/telegram/bot/types/transaction_partner.rb index 1c57c8c..edf2c5b 100644 --- a/lib/telegram/bot/types/transaction_partner.rb +++ b/lib/telegram/bot/types/transaction_partner.rb @@ -7,6 +7,7 @@ module Types # rubocop:disable Naming/ConstantName TransactionPartner = ( TransactionPartnerUser | + TransactionPartnerChat | TransactionPartnerAffiliateProgram | TransactionPartnerFragment | TransactionPartnerTelegramAds | diff --git a/lib/telegram/bot/types/transaction_partner_chat.rb b/lib/telegram/bot/types/transaction_partner_chat.rb new file mode 100644 index 0000000..21be9a6 --- /dev/null +++ b/lib/telegram/bot/types/transaction_partner_chat.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Telegram + module Bot + module Types + class TransactionPartnerChat < Base + attribute :type, Types::String.constrained(eql: 'chat').default('chat') + attribute :chat, Chat + attribute? :gift, Gift + end + end + end +end diff --git a/lib/telegram/bot/types/video.rb b/lib/telegram/bot/types/video.rb index ff916fd..3a92f07 100644 --- a/lib/telegram/bot/types/video.rb +++ b/lib/telegram/bot/types/video.rb @@ -10,6 +10,8 @@ class Video < Base attribute :height, Types::Integer attribute :duration, Types::Integer attribute? :thumbnail, PhotoSize + attribute? :cover, Types::Array.of(PhotoSize) + attribute? :start_timestamp, Types::Integer attribute? :file_name, Types::String attribute? :mime_type, Types::String attribute? :file_size, Types::Integer