telegram-bot-ruby 1.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -0
- data/.github/workflows/ci.yml +0 -3
- data/.github/workflows/stale.yml +19 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +12 -7
- data/CHANGELOG.md +16 -0
- data/Gemfile +11 -3
- data/LICENSE +0 -1
- data/README.md +64 -20
- data/Rakefile +0 -43
- data/bin/console +4 -1
- data/lib/telegram/bot/api/endpoints.rb +124 -0
- data/lib/telegram/bot/api.rb +20 -44
- data/lib/telegram/bot/client.rb +9 -10
- data/lib/telegram/bot/exceptions/response_error.rb +2 -8
- data/lib/telegram/bot/types/animation.rb +1 -1
- data/lib/telegram/bot/types/audio.rb +1 -1
- data/lib/telegram/bot/types/background_fill.rb +16 -0
- data/lib/telegram/bot/types/background_fill_freeform_gradient.rb +12 -0
- data/lib/telegram/bot/types/background_fill_gradient.rb +14 -0
- data/lib/telegram/bot/types/background_fill_solid.rb +12 -0
- data/lib/telegram/bot/types/background_type.rb +17 -0
- data/lib/telegram/bot/types/background_type_chat_theme.rb +12 -0
- data/lib/telegram/bot/types/background_type_fill.rb +13 -0
- data/lib/telegram/bot/types/background_type_pattern.rb +16 -0
- data/lib/telegram/bot/types/background_type_wallpaper.rb +15 -0
- data/lib/telegram/bot/types/birthdate.rb +13 -0
- data/lib/telegram/bot/types/bot_command.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope.rb +20 -0
- data/lib/telegram/bot/types/bot_command_scope_all_chat_administrators.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_all_group_chats.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_all_private_chats.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_chat.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_chat_administrators.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_chat_member.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_default.rb +1 -1
- data/lib/telegram/bot/types/bot_description.rb +11 -0
- data/lib/telegram/bot/types/bot_name.rb +11 -0
- data/lib/telegram/bot/types/bot_short_description.rb +11 -0
- data/lib/telegram/bot/types/business_connection.rb +16 -0
- data/lib/telegram/bot/types/business_intro.rb +13 -0
- data/lib/telegram/bot/types/business_location.rb +12 -0
- data/lib/telegram/bot/types/business_messages_deleted.rb +13 -0
- data/lib/telegram/bot/types/business_opening_hours.rb +12 -0
- data/lib/telegram/bot/types/business_opening_hours_interval.rb +12 -0
- data/lib/telegram/bot/types/callback_query.rb +1 -1
- data/lib/telegram/bot/types/chat.rb +1 -22
- data/lib/telegram/bot/types/chat_administrator_rights.rb +3 -0
- data/lib/telegram/bot/types/chat_background.rb +11 -0
- data/lib/telegram/bot/types/chat_boost.rb +14 -0
- data/lib/telegram/bot/types/chat_boost_added.rb +11 -0
- data/lib/telegram/bot/types/chat_boost_removed.rb +14 -0
- data/lib/telegram/bot/types/chat_boost_source.rb +16 -0
- data/lib/telegram/bot/types/chat_boost_source_gift_code.rb +12 -0
- data/lib/telegram/bot/types/chat_boost_source_giveaway.rb +15 -0
- data/lib/telegram/bot/types/chat_boost_source_premium.rb +12 -0
- data/lib/telegram/bot/types/chat_boost_updated.rb +12 -0
- data/lib/telegram/bot/types/chat_full_info.rb +54 -0
- data/lib/telegram/bot/types/chat_invite_link.rb +2 -0
- data/lib/telegram/bot/types/chat_location.rb +1 -1
- data/lib/telegram/bot/types/chat_member.rb +11 -2
- data/lib/telegram/bot/types/chat_member_administrator.rb +8 -5
- data/lib/telegram/bot/types/chat_member_banned.rb +2 -2
- data/lib/telegram/bot/types/chat_member_left.rb +2 -2
- data/lib/telegram/bot/types/chat_member_member.rb +3 -2
- data/lib/telegram/bot/types/chat_member_owner.rb +2 -2
- data/lib/telegram/bot/types/chat_member_restricted.rb +2 -2
- data/lib/telegram/bot/types/chat_member_updated.rb +2 -0
- data/lib/telegram/bot/types/chat_shared.rb +3 -0
- data/lib/telegram/bot/types/compactable.rb +2 -7
- data/lib/telegram/bot/types/copy_text_button.rb +11 -0
- data/lib/telegram/bot/types/document.rb +1 -1
- data/lib/telegram/bot/types/error.rb +14 -0
- data/lib/telegram/bot/types/external_reply_info.rb +34 -0
- data/lib/telegram/bot/types/force_reply.rb +3 -3
- data/lib/telegram/bot/types/gift.rb +15 -0
- data/lib/telegram/bot/types/gifts.rb +11 -0
- data/lib/telegram/bot/types/giveaway.rb +19 -0
- data/lib/telegram/bot/types/giveaway_completed.rb +14 -0
- data/lib/telegram/bot/types/giveaway_created.rb +11 -0
- data/lib/telegram/bot/types/giveaway_winners.rb +22 -0
- data/lib/telegram/bot/types/inaccessible_message.rb +13 -0
- data/lib/telegram/bot/types/inline_keyboard_button.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result.rb +33 -0
- data/lib/telegram/bot/types/inline_query_result_article.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_audio.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_document.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_video.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_contact.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_document.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_game.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_gif.rb +4 -3
- data/lib/telegram/bot/types/inline_query_result_location.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +4 -3
- data/lib/telegram/bot/types/inline_query_result_photo.rb +3 -2
- data/lib/telegram/bot/types/inline_query_result_venue.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_video.rb +3 -2
- data/lib/telegram/bot/types/inline_query_result_voice.rb +1 -1
- data/lib/telegram/bot/types/inline_query_results_button.rb +13 -0
- data/lib/telegram/bot/types/input_contact_message_content.rb +1 -1
- data/lib/telegram/bot/types/input_invoice_message_content.rb +5 -5
- data/lib/telegram/bot/types/input_location_message_content.rb +1 -1
- data/lib/telegram/bot/types/input_media.rb +18 -0
- data/lib/telegram/bot/types/input_media_animation.rb +3 -2
- data/lib/telegram/bot/types/input_media_audio.rb +2 -2
- data/lib/telegram/bot/types/input_media_document.rb +2 -2
- data/lib/telegram/bot/types/input_media_photo.rb +2 -1
- data/lib/telegram/bot/types/input_media_video.rb +3 -2
- data/lib/telegram/bot/types/input_message_content.rb +10 -2
- data/lib/telegram/bot/types/input_paid_media.rb +15 -0
- data/lib/telegram/bot/types/input_paid_media_photo.rb +12 -0
- data/lib/telegram/bot/types/input_paid_media_video.rb +17 -0
- data/lib/telegram/bot/types/input_poll_option.rb +13 -0
- data/lib/telegram/bot/types/input_sticker.rb +15 -0
- data/lib/telegram/bot/types/input_text_message_content.rb +3 -3
- data/lib/telegram/bot/types/input_venue_message_content.rb +1 -1
- data/lib/telegram/bot/types/keyboard_button.rb +1 -1
- data/lib/telegram/bot/types/keyboard_button_request_chat.rb +3 -0
- data/lib/telegram/bot/types/keyboard_button_request_users.rb +17 -0
- data/lib/telegram/bot/types/link_preview_options.rb +15 -0
- data/lib/telegram/bot/types/location.rb +1 -1
- data/lib/telegram/bot/types/maybe_inaccessible_message.rb +15 -0
- data/lib/telegram/bot/types/menu_button.rb +16 -0
- data/lib/telegram/bot/types/menu_button_commands.rb +1 -1
- data/lib/telegram/bot/types/menu_button_default.rb +1 -1
- data/lib/telegram/bot/types/menu_button_web_app.rb +1 -1
- data/lib/telegram/bot/types/message.rb +30 -16
- data/lib/telegram/bot/types/message_id.rb +11 -0
- data/lib/telegram/bot/types/message_origin.rb +17 -0
- data/lib/telegram/bot/types/message_origin_channel.rb +15 -0
- data/lib/telegram/bot/types/message_origin_chat.rb +14 -0
- data/lib/telegram/bot/types/message_origin_hidden_user.rb +13 -0
- data/lib/telegram/bot/types/message_origin_user.rb +13 -0
- data/lib/telegram/bot/types/message_reaction_count_updated.rb +14 -0
- data/lib/telegram/bot/types/message_reaction_updated.rb +17 -0
- data/lib/telegram/bot/types/paid_media.rb +16 -0
- data/lib/telegram/bot/types/paid_media_info.rb +12 -0
- data/lib/telegram/bot/types/paid_media_photo.rb +12 -0
- data/lib/telegram/bot/types/paid_media_preview.rb +14 -0
- data/lib/telegram/bot/types/paid_media_purchased.rb +12 -0
- data/lib/telegram/bot/types/paid_media_video.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error.rb +22 -0
- data/lib/telegram/bot/types/passport_element_error_data_field.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_file.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_files.rb +2 -2
- data/lib/telegram/bot/types/passport_element_error_front_side.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_selfie.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_translation_file.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -2
- data/lib/telegram/bot/types/passport_element_error_unspecified.rb +1 -1
- data/lib/telegram/bot/types/poll.rb +2 -1
- data/lib/telegram/bot/types/poll_answer.rb +2 -1
- data/lib/telegram/bot/types/poll_option.rb +2 -1
- data/lib/telegram/bot/types/prepared_inline_message.rb +12 -0
- data/lib/telegram/bot/types/reaction_count.rb +12 -0
- data/lib/telegram/bot/types/reaction_type.rb +16 -0
- data/lib/telegram/bot/types/reaction_type_custom_emoji.rb +12 -0
- data/lib/telegram/bot/types/reaction_type_emoji.rb +12 -0
- data/lib/telegram/bot/types/reaction_type_paid.rb +11 -0
- data/lib/telegram/bot/types/refunded_payment.rb +15 -0
- data/lib/telegram/bot/types/reply_keyboard_markup.rb +2 -2
- data/lib/telegram/bot/types/reply_keyboard_remove.rb +2 -2
- data/lib/telegram/bot/types/reply_parameters.rb +17 -0
- data/lib/telegram/bot/types/response_parameters.rb +12 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state.rb +16 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state_failed.rb +11 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state_pending.rb +11 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state_succeeded.rb +13 -0
- data/lib/telegram/bot/types/shared_user.rb +15 -0
- data/lib/telegram/bot/types/star_transaction.rb +15 -0
- data/lib/telegram/bot/types/star_transactions.rb +11 -0
- data/lib/telegram/bot/types/sticker.rb +2 -1
- data/lib/telegram/bot/types/sticker_set.rb +1 -3
- data/lib/telegram/bot/types/story.rb +12 -0
- data/lib/telegram/bot/types/successful_payment.rb +3 -0
- data/lib/telegram/bot/types/switch_inline_query_chosen_chat.rb +15 -0
- data/lib/telegram/bot/types/text_quote.rb +14 -0
- data/lib/telegram/bot/types/transaction_partner.rb +18 -0
- data/lib/telegram/bot/types/transaction_partner_fragment.rb +12 -0
- data/lib/telegram/bot/types/transaction_partner_other.rb +11 -0
- data/lib/telegram/bot/types/transaction_partner_telegram_ads.rb +11 -0
- data/lib/telegram/bot/types/transaction_partner_telegram_api.rb +12 -0
- data/lib/telegram/bot/types/transaction_partner_user.rb +17 -0
- data/lib/telegram/bot/types/update.rb +9 -0
- data/lib/telegram/bot/types/user.rb +4 -2
- data/lib/telegram/bot/types/user_chat_boosts.rb +11 -0
- data/lib/telegram/bot/types/{user_shared.rb → users_shared.rb} +2 -2
- data/lib/telegram/bot/types/video.rb +1 -1
- data/lib/telegram/bot/types/video_note.rb +1 -1
- data/lib/telegram/bot/types/webhook_info.rb +1 -1
- data/lib/telegram/bot/types/write_access_allowed.rb +3 -0
- data/lib/telegram/bot/version.rb +1 -1
- data/lib/telegram/bot.rb +1 -0
- data/rakelib/parse_schema.rake +73 -0
- data/rakelib/rebuild_types.rake +90 -0
- data/telegram-bot-ruby.gemspec +1 -4
- data/utility/empty_type.erb +14 -0
- data/utility/type.erb +13 -0
- data/utility/type_attributes.json +5138 -0
- metadata +105 -5
- data/lib/telegram/bot/types/keyboard_button_request_user.rb +0 -13
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class MessageOriginChat < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'chat').default('chat')
|
8
|
+
attribute :date, Types::Integer
|
9
|
+
attribute :sender_chat, Chat
|
10
|
+
attribute? :author_signature, Types::String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class MessageOriginHiddenUser < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'hidden_user').default('hidden_user')
|
8
|
+
attribute :date, Types::Integer
|
9
|
+
attribute :sender_user_name, Types::String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class MessageOriginUser < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'user').default('user')
|
8
|
+
attribute :date, Types::Integer
|
9
|
+
attribute :sender_user, User
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class MessageReactionCountUpdated < Base
|
7
|
+
attribute :chat, Chat
|
8
|
+
attribute :message_id, Types::Integer
|
9
|
+
attribute :date, Types::Integer
|
10
|
+
attribute :reactions, Types::Array.of(ReactionCount)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class MessageReactionUpdated < Base
|
7
|
+
attribute :chat, Chat
|
8
|
+
attribute :message_id, Types::Integer
|
9
|
+
attribute? :user, User
|
10
|
+
attribute? :actor_chat, Chat
|
11
|
+
attribute :date, Types::Integer
|
12
|
+
attribute :old_reaction, Types::Array.of(ReactionType)
|
13
|
+
attribute :new_reaction, Types::Array.of(ReactionType)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
## Just for classes consistency
|
7
|
+
# rubocop:disable Naming/ConstantName
|
8
|
+
PaidMedia = (
|
9
|
+
PaidMediaPreview |
|
10
|
+
PaidMediaPhoto |
|
11
|
+
PaidMediaVideo
|
12
|
+
)
|
13
|
+
# rubocop:enable Naming/ConstantName
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class PaidMediaPhoto < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'photo').default('photo')
|
8
|
+
attribute :photo, Types::Array.of(PhotoSize)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class PaidMediaPreview < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'preview').default('preview')
|
8
|
+
attribute? :width, Types::Integer
|
9
|
+
attribute? :height, Types::Integer
|
10
|
+
attribute? :duration, Types::Integer
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
## Just for classes consistency
|
7
|
+
# rubocop:disable Naming/ConstantName
|
8
|
+
PassportElementError = (
|
9
|
+
PassportElementErrorDataField |
|
10
|
+
PassportElementErrorFrontSide |
|
11
|
+
PassportElementErrorReverseSide |
|
12
|
+
PassportElementErrorSelfie |
|
13
|
+
PassportElementErrorFile |
|
14
|
+
PassportElementErrorFiles |
|
15
|
+
PassportElementErrorTranslationFile |
|
16
|
+
PassportElementErrorTranslationFiles |
|
17
|
+
PassportElementErrorUnspecified
|
18
|
+
)
|
19
|
+
# rubocop:enable Naming/ConstantName
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorDataField < Base
|
7
|
-
attribute :source, Types::String.default('data')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'data').default('data')
|
8
8
|
attribute :type, Types::String
|
9
9
|
attribute :field_name, Types::String
|
10
10
|
attribute :data_hash, Types::String
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorFile < Base
|
7
|
-
attribute :source, Types::String.default('file')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'file').default('file')
|
8
8
|
attribute :type, Types::String
|
9
9
|
attribute :file_hash, Types::String
|
10
10
|
attribute :message, Types::String
|
@@ -4,9 +4,9 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorFiles < Base
|
7
|
-
attribute :source, Types::String.default('files')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'files').default('files')
|
8
8
|
attribute :type, Types::String
|
9
|
-
attribute :file_hashes, Types::Array.of(String)
|
9
|
+
attribute :file_hashes, Types::Array.of(Types::String)
|
10
10
|
attribute :message, Types::String
|
11
11
|
end
|
12
12
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorFrontSide < Base
|
7
|
-
attribute :source, Types::String.default('front_side')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'front_side').default('front_side')
|
8
8
|
attribute :type, Types::String
|
9
9
|
attribute :file_hash, Types::String
|
10
10
|
attribute :message, Types::String
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorReverseSide < Base
|
7
|
-
attribute :source, Types::String.default('reverse_side')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'reverse_side').default('reverse_side')
|
8
8
|
attribute :type, Types::String
|
9
9
|
attribute :file_hash, Types::String
|
10
10
|
attribute :message, Types::String
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorSelfie < Base
|
7
|
-
attribute :source, Types::String.default('selfie')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'selfie').default('selfie')
|
8
8
|
attribute :type, Types::String
|
9
9
|
attribute :file_hash, Types::String
|
10
10
|
attribute :message, Types::String
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorTranslationFile < Base
|
7
|
-
attribute :source, Types::String.default('translation_file')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'translation_file').default('translation_file')
|
8
8
|
attribute :type, Types::String
|
9
9
|
attribute :file_hash, Types::String
|
10
10
|
attribute :message, Types::String
|
@@ -4,9 +4,9 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorTranslationFiles < Base
|
7
|
-
attribute :source, Types::String.default('translation_files')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'translation_files').default('translation_files')
|
8
8
|
attribute :type, Types::String
|
9
|
-
attribute :file_hashes, Types::Array.of(String)
|
9
|
+
attribute :file_hashes, Types::Array.of(Types::String)
|
10
10
|
attribute :message, Types::String
|
11
11
|
end
|
12
12
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorUnspecified < Base
|
7
|
-
attribute :source, Types::String.default('unspecified')
|
7
|
+
attribute :source, Types::String.constrained(eql: 'unspecified').default('unspecified')
|
8
8
|
attribute :type, Types::String
|
9
9
|
attribute :element_hash, Types::String
|
10
10
|
attribute :message, Types::String
|
@@ -5,7 +5,8 @@ module Telegram
|
|
5
5
|
module Types
|
6
6
|
class Poll < Base
|
7
7
|
attribute :id, Types::String
|
8
|
-
attribute :question, Types::String
|
8
|
+
attribute :question, Types::String.constrained(min_size: 1, max_size: 300)
|
9
|
+
attribute? :question_entities, Types::Array.of(MessageEntity)
|
9
10
|
attribute :options, Types::Array.of(PollOption)
|
10
11
|
attribute :total_voter_count, Types::Integer
|
11
12
|
attribute :is_closed, Types::Bool
|
@@ -4,7 +4,8 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PollOption < Base
|
7
|
-
attribute :text, Types::String
|
7
|
+
attribute :text, Types::String.constrained(min_size: 1, max_size: 100)
|
8
|
+
attribute? :text_entities, Types::Array.of(MessageEntity)
|
8
9
|
attribute :voter_count, Types::Integer
|
9
10
|
end
|
10
11
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
## Just for classes consistency
|
7
|
+
# rubocop:disable Naming/ConstantName
|
8
|
+
ReactionType = (
|
9
|
+
ReactionTypeEmoji |
|
10
|
+
ReactionTypeCustomEmoji |
|
11
|
+
ReactionTypePaid
|
12
|
+
)
|
13
|
+
# rubocop:enable Naming/ConstantName
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class ReactionTypeCustomEmoji < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'custom_emoji').default('custom_emoji')
|
8
|
+
attribute :custom_emoji_id, Types::String
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class RefundedPayment < Base
|
7
|
+
attribute :currency, Types::String.constrained(eql: 'XTR').default('XTR')
|
8
|
+
attribute :total_amount, Types::Integer
|
9
|
+
attribute :invoice_payload, Types::String
|
10
|
+
attribute :telegram_payment_charge_id, Types::String
|
11
|
+
attribute? :provider_payment_charge_id, Types::String
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -8,8 +8,8 @@ module Telegram
|
|
8
8
|
attribute? :is_persistent, Types::Bool.default(false)
|
9
9
|
attribute? :resize_keyboard, Types::Bool.default(false)
|
10
10
|
attribute? :one_time_keyboard, Types::Bool.default(false)
|
11
|
-
attribute? :input_field_placeholder, Types::String
|
12
|
-
attribute? :selective, Types::Bool
|
11
|
+
attribute? :input_field_placeholder, Types::String.constrained(min_size: 1, max_size: 64)
|
12
|
+
attribute? :selective, Types::Bool
|
13
13
|
|
14
14
|
def to_compact_hash
|
15
15
|
hsh = super
|
@@ -4,8 +4,8 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class ReplyKeyboardRemove < Base
|
7
|
-
attribute :remove_keyboard, Types::
|
8
|
-
attribute? :selective, Types::Bool
|
7
|
+
attribute :remove_keyboard, Types::True
|
8
|
+
attribute? :selective, Types::Bool
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class ReplyParameters < Base
|
7
|
+
attribute :message_id, Types::Integer
|
8
|
+
attribute? :chat_id, Types::Integer | Types::String
|
9
|
+
attribute? :allow_sending_without_reply, Types::Bool
|
10
|
+
attribute? :quote, Types::String
|
11
|
+
attribute? :quote_parse_mode, Types::String
|
12
|
+
attribute? :quote_entities, Types::Array.of(MessageEntity)
|
13
|
+
attribute? :quote_position, Types::Integer
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
## Just for classes consistency
|
7
|
+
# rubocop:disable Naming/ConstantName
|
8
|
+
RevenueWithdrawalState = (
|
9
|
+
RevenueWithdrawalStatePending |
|
10
|
+
RevenueWithdrawalStateSucceeded |
|
11
|
+
RevenueWithdrawalStateFailed
|
12
|
+
)
|
13
|
+
# rubocop:enable Naming/ConstantName
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class RevenueWithdrawalStateSucceeded < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'succeeded').default('succeeded')
|
8
|
+
attribute :date, Types::Integer
|
9
|
+
attribute :url, Types::String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class SharedUser < Base
|
7
|
+
attribute :user_id, Types::Integer
|
8
|
+
attribute? :first_name, Types::String
|
9
|
+
attribute? :last_name, Types::String
|
10
|
+
attribute? :username, Types::String
|
11
|
+
attribute? :photo, Types::Array.of(PhotoSize)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class StarTransaction < Base
|
7
|
+
attribute :id, Types::String
|
8
|
+
attribute :amount, Types::Integer
|
9
|
+
attribute :date, Types::Integer
|
10
|
+
attribute? :source, TransactionPartner
|
11
|
+
attribute? :receiver, TransactionPartner
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -11,12 +11,13 @@ module Telegram
|
|
11
11
|
attribute :height, Types::Integer
|
12
12
|
attribute :is_animated, Types::Bool
|
13
13
|
attribute :is_video, Types::Bool
|
14
|
-
attribute? :
|
14
|
+
attribute? :thumbnail, PhotoSize
|
15
15
|
attribute? :emoji, Types::String
|
16
16
|
attribute? :set_name, Types::String
|
17
17
|
attribute? :premium_animation, File
|
18
18
|
attribute? :mask_position, MaskPosition
|
19
19
|
attribute? :custom_emoji_id, Types::String
|
20
|
+
attribute? :needs_repainting, Types::True
|
20
21
|
attribute? :file_size, Types::Integer
|
21
22
|
end
|
22
23
|
end
|
@@ -7,10 +7,8 @@ module Telegram
|
|
7
7
|
attribute :name, Types::String
|
8
8
|
attribute :title, Types::String
|
9
9
|
attribute :sticker_type, Types::String
|
10
|
-
attribute :is_animated, Types::Bool
|
11
|
-
attribute :is_video, Types::Bool
|
12
10
|
attribute :stickers, Types::Array.of(Sticker)
|
13
|
-
attribute? :
|
11
|
+
attribute? :thumbnail, PhotoSize
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
@@ -7,6 +7,9 @@ module Telegram
|
|
7
7
|
attribute :currency, Types::String
|
8
8
|
attribute :total_amount, Types::Integer
|
9
9
|
attribute :invoice_payload, Types::String
|
10
|
+
attribute? :subscription_expiration_date, Types::Integer
|
11
|
+
attribute? :is_recurring, Types::True
|
12
|
+
attribute? :is_first_recurring, Types::True
|
10
13
|
attribute? :shipping_option_id, Types::String
|
11
14
|
attribute? :order_info, OrderInfo
|
12
15
|
attribute :telegram_payment_charge_id, Types::String
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class SwitchInlineQueryChosenChat < Base
|
7
|
+
attribute? :query, Types::String
|
8
|
+
attribute? :allow_user_chats, Types::Bool
|
9
|
+
attribute? :allow_bot_chats, Types::Bool
|
10
|
+
attribute? :allow_group_chats, Types::Bool
|
11
|
+
attribute? :allow_channel_chats, Types::Bool
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|