telegram-bot-ruby 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +6 -9
  4. data/lib/telegram/bot/api/endpoints.rb +16 -1
  5. data/lib/telegram/bot/types/bot_access_settings.rb +12 -0
  6. data/lib/telegram/bot/types/bot_command.rb +1 -0
  7. data/lib/telegram/bot/types/bot_subscription_updated.rb +13 -0
  8. data/lib/telegram/bot/types/chat_full_info.rb +2 -0
  9. data/lib/telegram/bot/types/chat_join_request.rb +1 -0
  10. data/lib/telegram/bot/types/chat_member_restricted.rb +1 -0
  11. data/lib/telegram/bot/types/chat_permissions.rb +1 -0
  12. data/lib/telegram/bot/types/community.rb +12 -0
  13. data/lib/telegram/bot/types/community_chat_added.rb +11 -0
  14. data/lib/telegram/bot/types/community_chat_removed.rb +10 -0
  15. data/lib/telegram/bot/types/external_reply_info.rb +1 -0
  16. data/lib/telegram/bot/types/inline_query_result_location.rb +1 -1
  17. data/lib/telegram/bot/types/input_location_message_content.rb +1 -1
  18. data/lib/telegram/bot/types/input_media.rb +2 -1
  19. data/lib/telegram/bot/types/input_media_link.rb +12 -0
  20. data/lib/telegram/bot/types/input_media_live_photo.rb +18 -0
  21. data/lib/telegram/bot/types/input_media_location.rb +14 -0
  22. data/lib/telegram/bot/types/input_media_sticker.rb +13 -0
  23. data/lib/telegram/bot/types/input_media_venue.rb +19 -0
  24. data/lib/telegram/bot/types/input_media_voice_note.rb +16 -0
  25. data/lib/telegram/bot/types/input_message_content.rb +1 -0
  26. data/lib/telegram/bot/types/input_paid_media.rb +1 -0
  27. data/lib/telegram/bot/types/input_paid_media_live_photo.rb +13 -0
  28. data/lib/telegram/bot/types/input_poll_media.rb +21 -0
  29. data/lib/telegram/bot/types/input_poll_option.rb +1 -0
  30. data/lib/telegram/bot/types/input_poll_option_media.rb +21 -0
  31. data/lib/telegram/bot/types/input_rich_block.rb +34 -0
  32. data/lib/telegram/bot/types/input_rich_block_anchor.rb +12 -0
  33. data/lib/telegram/bot/types/input_rich_block_animation.rb +13 -0
  34. data/lib/telegram/bot/types/input_rich_block_audio.rb +13 -0
  35. data/lib/telegram/bot/types/input_rich_block_block_quotation.rb +13 -0
  36. data/lib/telegram/bot/types/input_rich_block_collage.rb +13 -0
  37. data/lib/telegram/bot/types/input_rich_block_details.rb +14 -0
  38. data/lib/telegram/bot/types/input_rich_block_divider.rb +11 -0
  39. data/lib/telegram/bot/types/input_rich_block_footer.rb +12 -0
  40. data/lib/telegram/bot/types/input_rich_block_list.rb +12 -0
  41. data/lib/telegram/bot/types/input_rich_block_list_item.rb +15 -0
  42. data/lib/telegram/bot/types/input_rich_block_map.rb +16 -0
  43. data/lib/telegram/bot/types/input_rich_block_mathematical_expression.rb +12 -0
  44. data/lib/telegram/bot/types/input_rich_block_paragraph.rb +12 -0
  45. data/lib/telegram/bot/types/input_rich_block_photo.rb +13 -0
  46. data/lib/telegram/bot/types/input_rich_block_preformatted.rb +13 -0
  47. data/lib/telegram/bot/types/input_rich_block_pull_quotation.rb +13 -0
  48. data/lib/telegram/bot/types/input_rich_block_section_heading.rb +13 -0
  49. data/lib/telegram/bot/types/input_rich_block_slideshow.rb +13 -0
  50. data/lib/telegram/bot/types/input_rich_block_table.rb +15 -0
  51. data/lib/telegram/bot/types/input_rich_block_thinking.rb +12 -0
  52. data/lib/telegram/bot/types/input_rich_block_video.rb +13 -0
  53. data/lib/telegram/bot/types/input_rich_block_voice_note.rb +13 -0
  54. data/lib/telegram/bot/types/input_rich_message.rb +16 -0
  55. data/lib/telegram/bot/types/input_rich_message_content.rb +11 -0
  56. data/lib/telegram/bot/types/input_rich_message_media.rb +13 -0
  57. data/lib/telegram/bot/types/link.rb +11 -0
  58. data/lib/telegram/bot/types/live_photo.rb +18 -0
  59. data/lib/telegram/bot/types/message.rb +10 -1
  60. data/lib/telegram/bot/types/paid_media.rb +2 -1
  61. data/lib/telegram/bot/types/paid_media_live_photo.rb +12 -0
  62. data/lib/telegram/bot/types/poll.rb +4 -0
  63. data/lib/telegram/bot/types/poll_media.rb +20 -0
  64. data/lib/telegram/bot/types/poll_option.rb +1 -0
  65. data/lib/telegram/bot/types/poll_option_added.rb +1 -1
  66. data/lib/telegram/bot/types/poll_option_deleted.rb +1 -1
  67. data/lib/telegram/bot/types/reply_parameters.rb +2 -1
  68. data/lib/telegram/bot/types/rich_block.rb +34 -0
  69. data/lib/telegram/bot/types/rich_block_anchor.rb +12 -0
  70. data/lib/telegram/bot/types/rich_block_animation.rb +14 -0
  71. data/lib/telegram/bot/types/rich_block_audio.rb +13 -0
  72. data/lib/telegram/bot/types/rich_block_block_quotation.rb +13 -0
  73. data/lib/telegram/bot/types/rich_block_caption.rb +12 -0
  74. data/lib/telegram/bot/types/rich_block_collage.rb +13 -0
  75. data/lib/telegram/bot/types/rich_block_details.rb +14 -0
  76. data/lib/telegram/bot/types/rich_block_divider.rb +11 -0
  77. data/lib/telegram/bot/types/rich_block_footer.rb +12 -0
  78. data/lib/telegram/bot/types/rich_block_list.rb +12 -0
  79. data/lib/telegram/bot/types/rich_block_list_item.rb +16 -0
  80. data/lib/telegram/bot/types/rich_block_map.rb +16 -0
  81. data/lib/telegram/bot/types/rich_block_mathematical_expression.rb +12 -0
  82. data/lib/telegram/bot/types/rich_block_paragraph.rb +12 -0
  83. data/lib/telegram/bot/types/rich_block_photo.rb +14 -0
  84. data/lib/telegram/bot/types/rich_block_preformatted.rb +13 -0
  85. data/lib/telegram/bot/types/rich_block_pull_quotation.rb +13 -0
  86. data/lib/telegram/bot/types/rich_block_section_heading.rb +13 -0
  87. data/lib/telegram/bot/types/rich_block_slideshow.rb +13 -0
  88. data/lib/telegram/bot/types/rich_block_table.rb +15 -0
  89. data/lib/telegram/bot/types/rich_block_table_cell.rb +16 -0
  90. data/lib/telegram/bot/types/rich_block_thinking.rb +12 -0
  91. data/lib/telegram/bot/types/rich_block_video.rb +14 -0
  92. data/lib/telegram/bot/types/rich_block_voice_note.rb +13 -0
  93. data/lib/telegram/bot/types/rich_message.rb +12 -0
  94. data/lib/telegram/bot/types/rich_text.rb +38 -0
  95. data/lib/telegram/bot/types/rich_text_anchor.rb +12 -0
  96. data/lib/telegram/bot/types/rich_text_anchor_link.rb +13 -0
  97. data/lib/telegram/bot/types/rich_text_bank_card_number.rb +13 -0
  98. data/lib/telegram/bot/types/rich_text_bold.rb +12 -0
  99. data/lib/telegram/bot/types/rich_text_bot_command.rb +13 -0
  100. data/lib/telegram/bot/types/rich_text_cashtag.rb +13 -0
  101. data/lib/telegram/bot/types/rich_text_code.rb +12 -0
  102. data/lib/telegram/bot/types/rich_text_custom_emoji.rb +13 -0
  103. data/lib/telegram/bot/types/rich_text_date_time.rb +14 -0
  104. data/lib/telegram/bot/types/rich_text_email_address.rb +13 -0
  105. data/lib/telegram/bot/types/rich_text_hashtag.rb +13 -0
  106. data/lib/telegram/bot/types/rich_text_italic.rb +12 -0
  107. data/lib/telegram/bot/types/rich_text_marked.rb +12 -0
  108. data/lib/telegram/bot/types/rich_text_mathematical_expression.rb +12 -0
  109. data/lib/telegram/bot/types/rich_text_mention.rb +13 -0
  110. data/lib/telegram/bot/types/rich_text_phone_number.rb +13 -0
  111. data/lib/telegram/bot/types/rich_text_reference.rb +13 -0
  112. data/lib/telegram/bot/types/rich_text_reference_link.rb +13 -0
  113. data/lib/telegram/bot/types/rich_text_spoiler.rb +12 -0
  114. data/lib/telegram/bot/types/rich_text_strikethrough.rb +12 -0
  115. data/lib/telegram/bot/types/rich_text_subscript.rb +12 -0
  116. data/lib/telegram/bot/types/rich_text_superscript.rb +12 -0
  117. data/lib/telegram/bot/types/rich_text_text_mention.rb +13 -0
  118. data/lib/telegram/bot/types/rich_text_underline.rb +12 -0
  119. data/lib/telegram/bot/types/rich_text_url.rb +13 -0
  120. data/lib/telegram/bot/types/sent_guest_message.rb +11 -0
  121. data/lib/telegram/bot/types/update.rb +2 -0
  122. data/lib/telegram/bot/types/user.rb +2 -0
  123. data/lib/telegram/bot/types.rb +6 -0
  124. data/lib/telegram/bot/version.rb +1 -1
  125. data/rakelib/builders/type_builder.rb +5 -2
  126. data/rakelib/builders/type_dependencies.rb +45 -0
  127. data/rakelib/rebuild.rake +4 -1
  128. metadata +100 -2
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichBlockListItem < Base
7
+ attribute :blocks, Types::Array.of(Types.deferred(:InputRichBlock))
8
+ attribute? :has_checkbox, Types::True
9
+ attribute? :is_checked, Types::True
10
+ attribute? :value, Types::Integer
11
+ attribute? :type, Types::String
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichBlockMap < Base
7
+ attribute :type, Types::String.constrained(eql: 'map').default('map')
8
+ attribute :location, Location
9
+ attribute :zoom, Types::Integer
10
+ attribute :width, Types::Integer
11
+ attribute :height, Types::Integer
12
+ attribute? :caption, RichBlockCaption
13
+ end
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 InputRichBlockMathematicalExpression < Base
7
+ attribute :type, Types::String.constrained(eql: 'mathematical_expression').default('mathematical_expression')
8
+ attribute :expression, Types::String
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichBlockParagraph < Base
7
+ attribute :type, Types::String.constrained(eql: 'paragraph').default('paragraph')
8
+ attribute :text, RichText
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichBlockPhoto < Base
7
+ attribute :type, Types::String.constrained(eql: 'photo').default('photo')
8
+ attribute :photo, InputMediaPhoto
9
+ attribute? :caption, RichBlockCaption
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 InputRichBlockPreformatted < Base
7
+ attribute :type, Types::String.constrained(eql: 'pre').default('pre')
8
+ attribute :text, RichText
9
+ attribute? :language, 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 InputRichBlockPullQuotation < Base
7
+ attribute :type, Types::String.constrained(eql: 'pullquote').default('pullquote')
8
+ attribute :text, RichText
9
+ attribute? :credit, RichText
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 InputRichBlockSectionHeading < Base
7
+ attribute :type, Types::String.constrained(eql: 'heading').default('heading')
8
+ attribute :text, RichText
9
+ attribute :size, Types::Integer
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 InputRichBlockSlideshow < Base
7
+ attribute :type, Types::String.constrained(eql: 'slideshow').default('slideshow')
8
+ attribute :blocks, Types::Array.of(Types.deferred(:InputRichBlock))
9
+ attribute? :caption, RichBlockCaption
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 InputRichBlockTable < Base
7
+ attribute :type, Types::String.constrained(eql: 'table').default('table')
8
+ attribute :cells, Types::Array.of(Types::Array.of(RichBlockTableCell))
9
+ attribute? :is_bordered, Types::True
10
+ attribute? :is_striped, Types::True
11
+ attribute? :caption, RichText
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichBlockThinking < Base
7
+ attribute :type, Types::String.constrained(eql: 'thinking').default('thinking')
8
+ attribute :text, RichText
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichBlockVideo < Base
7
+ attribute :type, Types::String.constrained(eql: 'video').default('video')
8
+ attribute :video, InputMediaVideo
9
+ attribute? :caption, RichBlockCaption
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 InputRichBlockVoiceNote < Base
7
+ attribute :type, Types::String.constrained(eql: 'voice_note').default('voice_note')
8
+ attribute :voice_note, InputMediaVoiceNote
9
+ attribute? :caption, RichBlockCaption
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichMessage < Base
7
+ attribute? :blocks, Types::Array.of(InputRichBlock)
8
+ attribute? :html, Types::String
9
+ attribute? :markdown, Types::String
10
+ attribute? :media, Types::Array.of(InputRichMessageMedia)
11
+ attribute? :is_rtl, Types::Bool
12
+ attribute? :skip_entity_detection, Types::Bool
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichMessageContent < Base
7
+ attribute :rich_message, InputRichMessage
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichMessageMedia < Base
7
+ attribute :id, Types::String.constrained(min_size: 1, max_size: 64)
8
+ attribute :media,
9
+ InputMediaAnimation | InputMediaAudio | InputMediaPhoto | InputMediaVideo | InputMediaVoiceNote
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class Link < Base
7
+ attribute :url, Types::String
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class LivePhoto < Base
7
+ attribute? :photo, Types::Array.of(PhotoSize)
8
+ attribute :file_id, Types::String
9
+ attribute :file_unique_id, Types::String
10
+ attribute :width, Types::Integer
11
+ attribute :height, Types::Integer
12
+ attribute :duration, Types::Integer
13
+ attribute? :mime_type, Types::String
14
+ attribute? :file_size, Types::Integer
15
+ end
16
+ end
17
+ end
18
+ end
@@ -12,7 +12,10 @@ module Telegram
12
12
  attribute? :sender_boost_count, Types::Integer
13
13
  attribute? :sender_business_bot, User
14
14
  attribute? :sender_tag, Types::String
15
+ attribute? :receiver_user, User
16
+ attribute? :ephemeral_message_id, Types::Integer
15
17
  attribute :date, Types::Integer
18
+ attribute? :guest_query_id, Types::String
16
19
  attribute? :business_connection_id, Types::String
17
20
  attribute :chat, Chat
18
21
  attribute? :forward_origin, MessageOrigin
@@ -25,6 +28,8 @@ module Telegram
25
28
  attribute? :reply_to_checklist_task_id, Types::Integer
26
29
  attribute? :reply_to_poll_option_id, Types::String
27
30
  attribute? :via_bot, User
31
+ attribute? :guest_bot_caller_user, User
32
+ attribute? :guest_bot_caller_chat, Chat
28
33
  attribute? :edit_date, Types::Integer
29
34
  attribute? :has_protected_content, Types::True
30
35
  attribute? :is_from_offline, Types::True
@@ -37,9 +42,11 @@ module Telegram
37
42
  attribute? :link_preview_options, LinkPreviewOptions
38
43
  attribute? :suggested_post_info, SuggestedPostInfo
39
44
  attribute? :effect_id, Types::String
45
+ attribute? :rich_message, RichMessage
40
46
  attribute? :animation, Animation
41
47
  attribute? :audio, Audio
42
48
  attribute? :document, Document
49
+ attribute? :live_photo, LivePhoto
43
50
  attribute? :paid_media, PaidMediaInfo
44
51
  attribute? :photo, Types::Array.of(PhotoSize)
45
52
  attribute? :sticker, Sticker
@@ -71,7 +78,7 @@ module Telegram
71
78
  attribute? :message_auto_delete_timer_changed, MessageAutoDeleteTimerChanged
72
79
  attribute? :migrate_to_chat_id, Types::Integer
73
80
  attribute? :migrate_from_chat_id, Types::Integer
74
- attribute? :pinned_message, MaybeInaccessibleMessage
81
+ attribute? :pinned_message, Types.deferred(:MaybeInaccessibleMessage)
75
82
  attribute? :invoice, Invoice
76
83
  attribute? :successful_payment, SuccessfulPayment
77
84
  attribute? :refunded_payment, RefundedPayment
@@ -88,6 +95,8 @@ module Telegram
88
95
  attribute? :chat_background_set, ChatBackground
89
96
  attribute? :checklist_tasks_done, ChecklistTasksDone
90
97
  attribute? :checklist_tasks_added, ChecklistTasksAdded
98
+ attribute? :community_chat_added, CommunityChatAdded
99
+ attribute? :community_chat_removed, CommunityChatRemoved
91
100
  attribute? :direct_message_price_changed, DirectMessagePriceChanged
92
101
  attribute? :forum_topic_created, ForumTopicCreated
93
102
  attribute? :forum_topic_edited, ForumTopicEdited
@@ -6,8 +6,9 @@ module Telegram
6
6
  ## Just for classes consistency
7
7
  # rubocop:disable Naming/ConstantName
8
8
  PaidMedia = (
9
- PaidMediaPreview |
9
+ PaidMediaLivePhoto |
10
10
  PaidMediaPhoto |
11
+ PaidMediaPreview |
11
12
  PaidMediaVideo
12
13
  )
13
14
  # rubocop:enable Naming/ConstantName
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class PaidMediaLivePhoto < Base
7
+ attribute :type, Types::String.constrained(eql: 'live_photo').default('live_photo')
8
+ attribute :live_photo, LivePhoto
9
+ end
10
+ end
11
+ end
12
+ end
@@ -14,13 +14,17 @@ module Telegram
14
14
  attribute :type, Types::String
15
15
  attribute :allows_multiple_answers, Types::Bool
16
16
  attribute :allows_revoting, Types::Bool
17
+ attribute :members_only, Types::Bool
18
+ attribute? :country_codes, Types::Array.of(Types::String)
17
19
  attribute? :correct_option_ids, Types::Array.of(Types::Integer)
18
20
  attribute? :explanation, Types::String
19
21
  attribute? :explanation_entities, Types::Array.of(MessageEntity)
22
+ attribute? :explanation_media, PollMedia
20
23
  attribute? :open_period, Types::Integer
21
24
  attribute? :close_date, Types::Integer
22
25
  attribute? :description, Types::String
23
26
  attribute? :description_entities, Types::Array.of(MessageEntity)
27
+ attribute? :media, PollMedia
24
28
  end
25
29
  end
26
30
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class PollMedia < Base
7
+ attribute? :animation, Animation
8
+ attribute? :audio, Audio
9
+ attribute? :document, Document
10
+ attribute? :link, Link
11
+ attribute? :live_photo, LivePhoto
12
+ attribute? :location, Location
13
+ attribute? :photo, Types::Array.of(PhotoSize)
14
+ attribute? :sticker, Sticker
15
+ attribute? :venue, Venue
16
+ attribute? :video, Video
17
+ end
18
+ end
19
+ end
20
+ end
@@ -7,6 +7,7 @@ module Telegram
7
7
  attribute :persistent_id, Types::String
8
8
  attribute :text, Types::String.constrained(min_size: 1, max_size: 100)
9
9
  attribute? :text_entities, Types::Array.of(MessageEntity)
10
+ attribute? :media, PollMedia
10
11
  attribute :voter_count, Types::Integer
11
12
  attribute? :added_by_user, User
12
13
  attribute? :added_by_chat, Chat
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PollOptionAdded < Base
7
- attribute? :poll_message, MaybeInaccessibleMessage
7
+ attribute? :poll_message, Types.deferred(:MaybeInaccessibleMessage)
8
8
  attribute :option_persistent_id, Types::String
9
9
  attribute :option_text, Types::String
10
10
  attribute? :option_text_entities, Types::Array.of(MessageEntity)
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PollOptionDeleted < Base
7
- attribute? :poll_message, MaybeInaccessibleMessage
7
+ attribute? :poll_message, Types.deferred(:MaybeInaccessibleMessage)
8
8
  attribute :option_persistent_id, Types::String
9
9
  attribute :option_text, Types::String
10
10
  attribute? :option_text_entities, Types::Array.of(MessageEntity)
@@ -4,8 +4,9 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class ReplyParameters < Base
7
- attribute :message_id, Types::Integer
7
+ attribute? :message_id, Types::Integer
8
8
  attribute? :chat_id, Types::Integer | Types::String
9
+ attribute? :ephemeral_message_id, Types::Integer
9
10
  attribute? :allow_sending_without_reply, Types::Bool
10
11
  attribute? :quote, Types::String
11
12
  attribute? :quote_parse_mode, Types::String
@@ -0,0 +1,34 @@
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
+ RichBlock = (
9
+ RichBlockParagraph |
10
+ RichBlockSectionHeading |
11
+ RichBlockPreformatted |
12
+ RichBlockFooter |
13
+ RichBlockDivider |
14
+ RichBlockMathematicalExpression |
15
+ RichBlockAnchor |
16
+ RichBlockList |
17
+ RichBlockBlockQuotation |
18
+ RichBlockPullQuotation |
19
+ RichBlockCollage |
20
+ RichBlockSlideshow |
21
+ RichBlockTable |
22
+ RichBlockDetails |
23
+ RichBlockMap |
24
+ RichBlockAnimation |
25
+ RichBlockAudio |
26
+ RichBlockPhoto |
27
+ RichBlockVideo |
28
+ RichBlockVoiceNote |
29
+ RichBlockThinking
30
+ )
31
+ # rubocop:enable Naming/ConstantName
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockAnchor < Base
7
+ attribute :type, Types::String.constrained(eql: 'anchor').default('anchor')
8
+ attribute :name, Types::String
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 RichBlockAnimation < Base
7
+ attribute :type, Types::String.constrained(eql: 'animation').default('animation')
8
+ attribute :animation, Animation
9
+ attribute? :has_spoiler, Types::True
10
+ attribute? :caption, RichBlockCaption
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 RichBlockAudio < Base
7
+ attribute :type, Types::String.constrained(eql: 'audio').default('audio')
8
+ attribute :audio, Audio
9
+ attribute? :caption, RichBlockCaption
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 RichBlockBlockQuotation < Base
7
+ attribute :type, Types::String.constrained(eql: 'blockquote').default('blockquote')
8
+ attribute :blocks, Types::Array.of(Types.deferred(:RichBlock))
9
+ attribute? :credit, RichText
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockCaption < Base
7
+ attribute :text, RichText
8
+ attribute? :credit, RichText
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockCollage < Base
7
+ attribute :type, Types::String.constrained(eql: 'collage').default('collage')
8
+ attribute :blocks, Types::Array.of(Types.deferred(:RichBlock))
9
+ attribute? :caption, RichBlockCaption
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 RichBlockDetails < Base
7
+ attribute :type, Types::String.constrained(eql: 'details').default('details')
8
+ attribute :summary, RichText
9
+ attribute :blocks, Types::Array.of(Types.deferred(:RichBlock))
10
+ attribute? :is_open, Types::True
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockDivider < Base
7
+ attribute :type, Types::String.constrained(eql: 'divider').default('divider')
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockFooter < Base
7
+ attribute :type, Types::String.constrained(eql: 'footer').default('footer')
8
+ attribute :text, RichText
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockList < Base
7
+ attribute :type, Types::String.constrained(eql: 'list').default('list')
8
+ attribute :items, Types::Array.of(RichBlockListItem)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockListItem < Base
7
+ attribute :label, Types::String
8
+ attribute :blocks, Types::Array.of(Types.deferred(:RichBlock))
9
+ attribute? :has_checkbox, Types::True
10
+ attribute? :is_checked, Types::True
11
+ attribute? :value, Types::Integer
12
+ attribute? :type, Types::String
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class RichBlockMap < Base
7
+ attribute :type, Types::String.constrained(eql: 'map').default('map')
8
+ attribute :location, Location
9
+ attribute :zoom, Types::Integer
10
+ attribute :width, Types::Integer
11
+ attribute :height, Types::Integer
12
+ attribute? :caption, RichBlockCaption
13
+ end
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 RichBlockMathematicalExpression < Base
7
+ attribute :type, Types::String.constrained(eql: 'mathematical_expression').default('mathematical_expression')
8
+ attribute :expression, Types::String
9
+ end
10
+ end
11
+ end
12
+ end