telegram-bot-ruby 1.0.0.rc1 → 2.0.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 (136) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +10 -0
  3. data/.github/workflows/ci.yml +2 -5
  4. data/.github/workflows/stale.yml +19 -0
  5. data/.gitignore +1 -0
  6. data/.rspec +1 -0
  7. data/.rubocop.yml +12 -7
  8. data/CHANGELOG.md +17 -0
  9. data/Gemfile +13 -0
  10. data/LICENSE +0 -1
  11. data/README.md +78 -19
  12. data/Rakefile +10 -8
  13. data/bin/console +4 -1
  14. data/lib/telegram/bot/api/endpoints.rb +114 -0
  15. data/lib/telegram/bot/api.rb +20 -44
  16. data/lib/telegram/bot/client.rb +8 -9
  17. data/lib/telegram/bot/exceptions/response_error.rb +2 -8
  18. data/lib/telegram/bot/types/animation.rb +1 -1
  19. data/lib/telegram/bot/types/audio.rb +1 -1
  20. data/lib/telegram/bot/types/bot_command_scope_all_chat_administrators.rb +1 -1
  21. data/lib/telegram/bot/types/bot_command_scope_all_group_chats.rb +1 -1
  22. data/lib/telegram/bot/types/bot_command_scope_all_private_chats.rb +1 -1
  23. data/lib/telegram/bot/types/bot_command_scope_chat.rb +2 -2
  24. data/lib/telegram/bot/types/bot_command_scope_chat_administrators.rb +2 -2
  25. data/lib/telegram/bot/types/bot_command_scope_chat_member.rb +2 -2
  26. data/lib/telegram/bot/types/bot_command_scope_default.rb +1 -1
  27. data/lib/telegram/bot/types/bot_description.rb +11 -0
  28. data/lib/telegram/bot/types/bot_name.rb +11 -0
  29. data/lib/telegram/bot/types/bot_short_description.rb +11 -0
  30. data/lib/telegram/bot/types/callback_query.rb +1 -1
  31. data/lib/telegram/bot/types/chat.rb +16 -9
  32. data/lib/telegram/bot/types/chat_administrator_rights.rb +3 -0
  33. data/lib/telegram/bot/types/chat_boost.rb +14 -0
  34. data/lib/telegram/bot/types/chat_boost_removed.rb +14 -0
  35. data/lib/telegram/bot/types/chat_boost_source.rb +13 -0
  36. data/lib/telegram/bot/types/chat_boost_source_gift_code.rb +12 -0
  37. data/lib/telegram/bot/types/chat_boost_source_giveaway.rb +14 -0
  38. data/lib/telegram/bot/types/chat_boost_source_premium.rb +12 -0
  39. data/lib/telegram/bot/types/chat_boost_updated.rb +12 -0
  40. data/lib/telegram/bot/types/chat_join_request.rb +1 -0
  41. data/lib/telegram/bot/types/chat_member.rb +11 -2
  42. data/lib/telegram/bot/types/chat_member_administrator.rb +8 -5
  43. data/lib/telegram/bot/types/chat_member_banned.rb +2 -2
  44. data/lib/telegram/bot/types/chat_member_left.rb +2 -2
  45. data/lib/telegram/bot/types/chat_member_member.rb +2 -2
  46. data/lib/telegram/bot/types/chat_member_owner.rb +2 -2
  47. data/lib/telegram/bot/types/chat_member_restricted.rb +12 -7
  48. data/lib/telegram/bot/types/chat_member_updated.rb +1 -0
  49. data/lib/telegram/bot/types/chat_permissions.rb +6 -1
  50. data/lib/telegram/bot/types/chat_shared.rb +12 -0
  51. data/lib/telegram/bot/types/compactable.rb +2 -7
  52. data/lib/telegram/bot/types/document.rb +1 -1
  53. data/lib/telegram/bot/types/external_reply_info.rb +33 -0
  54. data/lib/telegram/bot/types/force_reply.rb +1 -1
  55. data/lib/telegram/bot/types/giveaway.rb +18 -0
  56. data/lib/telegram/bot/types/giveaway_completed.rb +13 -0
  57. data/lib/telegram/bot/types/giveaway_created.rb +10 -0
  58. data/lib/telegram/bot/types/giveaway_winners.rb +21 -0
  59. data/lib/telegram/bot/types/inaccessible_message.rb +13 -0
  60. data/lib/telegram/bot/types/inline_keyboard_button.rb +1 -0
  61. data/lib/telegram/bot/types/inline_query_result_article.rb +4 -4
  62. data/lib/telegram/bot/types/inline_query_result_audio.rb +1 -1
  63. data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +1 -1
  64. data/lib/telegram/bot/types/inline_query_result_cached_document.rb +1 -1
  65. data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +1 -1
  66. data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +1 -1
  67. data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +1 -1
  68. data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +1 -1
  69. data/lib/telegram/bot/types/inline_query_result_cached_video.rb +1 -1
  70. data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +1 -1
  71. data/lib/telegram/bot/types/inline_query_result_contact.rb +4 -4
  72. data/lib/telegram/bot/types/inline_query_result_document.rb +4 -4
  73. data/lib/telegram/bot/types/inline_query_result_game.rb +1 -1
  74. data/lib/telegram/bot/types/inline_query_result_gif.rb +3 -3
  75. data/lib/telegram/bot/types/inline_query_result_location.rb +4 -4
  76. data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +3 -3
  77. data/lib/telegram/bot/types/inline_query_result_photo.rb +2 -2
  78. data/lib/telegram/bot/types/inline_query_result_venue.rb +4 -4
  79. data/lib/telegram/bot/types/inline_query_result_video.rb +2 -2
  80. data/lib/telegram/bot/types/inline_query_result_voice.rb +1 -1
  81. data/lib/telegram/bot/types/input_media_animation.rb +2 -2
  82. data/lib/telegram/bot/types/input_media_audio.rb +2 -2
  83. data/lib/telegram/bot/types/input_media_document.rb +2 -2
  84. data/lib/telegram/bot/types/input_media_photo.rb +1 -1
  85. data/lib/telegram/bot/types/input_media_video.rb +2 -2
  86. data/lib/telegram/bot/types/input_text_message_content.rb +1 -1
  87. data/lib/telegram/bot/types/keyboard_button.rb +2 -0
  88. data/lib/telegram/bot/types/keyboard_button_request_chat.rb +18 -0
  89. data/lib/telegram/bot/types/keyboard_button_request_users.rb +14 -0
  90. data/lib/telegram/bot/types/link_preview_options.rb +15 -0
  91. data/lib/telegram/bot/types/maybe_inaccessible_message.rb +12 -0
  92. data/lib/telegram/bot/types/menu_button_commands.rb +1 -1
  93. data/lib/telegram/bot/types/menu_button_default.rb +1 -1
  94. data/lib/telegram/bot/types/menu_button_web_app.rb +1 -1
  95. data/lib/telegram/bot/types/message.rb +20 -15
  96. data/lib/telegram/bot/types/message_id.rb +11 -0
  97. data/lib/telegram/bot/types/message_origin.rb +14 -0
  98. data/lib/telegram/bot/types/message_origin_channel.rb +15 -0
  99. data/lib/telegram/bot/types/message_origin_chat.rb +14 -0
  100. data/lib/telegram/bot/types/message_origin_hidden_user.rb +13 -0
  101. data/lib/telegram/bot/types/message_origin_user.rb +13 -0
  102. data/lib/telegram/bot/types/message_reaction_count_updated.rb +14 -0
  103. data/lib/telegram/bot/types/message_reaction_updated.rb +17 -0
  104. data/lib/telegram/bot/types/passport_element_error_data_field.rb +1 -1
  105. data/lib/telegram/bot/types/passport_element_error_file.rb +1 -1
  106. data/lib/telegram/bot/types/passport_element_error_files.rb +2 -2
  107. data/lib/telegram/bot/types/passport_element_error_front_side.rb +1 -1
  108. data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +1 -1
  109. data/lib/telegram/bot/types/passport_element_error_selfie.rb +1 -1
  110. data/lib/telegram/bot/types/passport_element_error_translation_file.rb +1 -1
  111. data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -2
  112. data/lib/telegram/bot/types/passport_element_error_unspecified.rb +1 -1
  113. data/lib/telegram/bot/types/poll_answer.rb +2 -1
  114. data/lib/telegram/bot/types/reaction_count.rb +12 -0
  115. data/lib/telegram/bot/types/reaction_type.rb +12 -0
  116. data/lib/telegram/bot/types/reaction_type_custom_emoji.rb +12 -0
  117. data/lib/telegram/bot/types/reaction_type_emoji.rb +12 -0
  118. data/lib/telegram/bot/types/reply_keyboard_remove.rb +1 -1
  119. data/lib/telegram/bot/types/reply_parameters.rb +17 -0
  120. data/lib/telegram/bot/types/sticker.rb +2 -1
  121. data/lib/telegram/bot/types/sticker_set.rb +1 -1
  122. data/lib/telegram/bot/types/story.rb +9 -0
  123. data/lib/telegram/bot/types/switch_inline_query_chosen_chat.rb +15 -0
  124. data/lib/telegram/bot/types/text_quote.rb +14 -0
  125. data/lib/telegram/bot/types/update.rb +4 -0
  126. data/lib/telegram/bot/types/user.rb +2 -2
  127. data/lib/telegram/bot/types/user_chat_boosts.rb +11 -0
  128. data/lib/telegram/bot/types/users_shared.rb +12 -0
  129. data/lib/telegram/bot/types/video.rb +1 -1
  130. data/lib/telegram/bot/types/video_note.rb +1 -1
  131. data/lib/telegram/bot/types/webhook_info.rb +1 -1
  132. data/lib/telegram/bot/types/write_access_allowed.rb +3 -0
  133. data/lib/telegram/bot/version.rb +1 -1
  134. data/lib/telegram/bot.rb +1 -0
  135. data/telegram-bot-ruby.gemspec +1 -13
  136. metadata +47 -117
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InaccessibleMessage < Base
7
+ attribute :chat, Chat
8
+ attribute :message_id, Types::Integer
9
+ attribute :date, Types::Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -11,6 +11,7 @@ module Telegram
11
11
  attribute? :login_url, LoginUrl
12
12
  attribute? :switch_inline_query, Types::String
13
13
  attribute? :switch_inline_query_current_chat, Types::String
14
+ attribute? :switch_inline_query_chosen_chat, Types::SwitchInlineQueryChosenChat
14
15
  attribute? :callback_game, CallbackGame
15
16
  attribute? :pay, Types::Bool
16
17
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultArticle < Base
7
- attribute :type, Types::String.default('article')
7
+ attribute :type, Types::String.constrained(eql: 'article').default('article')
8
8
  attribute :id, Types::String
9
9
  attribute :title, Types::String
10
10
  attribute :input_message_content, InputMessageContent
@@ -12,9 +12,9 @@ module Telegram
12
12
  attribute? :url, Types::String
13
13
  attribute? :hide_url, Types::Bool
14
14
  attribute? :description, Types::String
15
- attribute? :thumb_url, Types::String
16
- attribute? :thumb_width, Types::Integer
17
- attribute? :thumb_height, Types::Integer
15
+ attribute? :thumbnail_url, Types::String
16
+ attribute? :thumbnail_width, Types::Integer
17
+ attribute? :thumbnail_height, Types::Integer
18
18
  end
19
19
  end
20
20
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultAudio < Base
7
- attribute :type, Types::String.default('audio')
7
+ attribute :type, Types::String.constrained(eql: 'audio').default('audio')
8
8
  attribute :id, Types::String
9
9
  attribute :audio_url, Types::String
10
10
  attribute :title, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedAudio < Base
7
- attribute :type, Types::String.default('audio')
7
+ attribute :type, Types::String.constrained(eql: 'audio').default('audio')
8
8
  attribute :id, Types::String
9
9
  attribute :audio_file_id, Types::String
10
10
  attribute? :caption, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedDocument < Base
7
- attribute :type, Types::String.default('document')
7
+ attribute :type, Types::String.constrained(eql: 'document').default('document')
8
8
  attribute :id, Types::String
9
9
  attribute :title, Types::String
10
10
  attribute :document_file_id, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedGif < Base
7
- attribute :type, Types::String.default('gif')
7
+ attribute :type, Types::String.constrained(eql: 'gif').default('gif')
8
8
  attribute :id, Types::String
9
9
  attribute :gif_file_id, Types::String
10
10
  attribute? :title, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedMpeg4Gif < Base
7
- attribute :type, Types::String.default('mpeg4_gif')
7
+ attribute :type, Types::String.constrained(eql: 'mpeg4_gif').default('mpeg4_gif')
8
8
  attribute :id, Types::String
9
9
  attribute :mpeg4_file_id, Types::String
10
10
  attribute? :title, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedPhoto < Base
7
- attribute :type, Types::String.default('photo')
7
+ attribute :type, Types::String.constrained(eql: 'photo').default('photo')
8
8
  attribute :id, Types::String
9
9
  attribute :photo_file_id, Types::String
10
10
  attribute? :title, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedSticker < Base
7
- attribute :type, Types::String.default('sticker')
7
+ attribute :type, Types::String.constrained(eql: 'sticker').default('sticker')
8
8
  attribute :id, Types::String
9
9
  attribute :sticker_file_id, Types::String
10
10
  attribute? :reply_markup, InlineKeyboardMarkup
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedVideo < Base
7
- attribute :type, Types::String.default('video')
7
+ attribute :type, Types::String.constrained(eql: 'video').default('video')
8
8
  attribute :id, Types::String
9
9
  attribute :video_file_id, Types::String
10
10
  attribute :title, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedVoice < Base
7
- attribute :type, Types::String.default('voice')
7
+ attribute :type, Types::String.constrained(eql: 'voice').default('voice')
8
8
  attribute :id, Types::String
9
9
  attribute :voice_file_id, Types::String
10
10
  attribute :title, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultContact < Base
7
- attribute :type, Types::String.default('contact')
7
+ attribute :type, Types::String.constrained(eql: 'contact').default('contact')
8
8
  attribute :id, Types::String
9
9
  attribute :phone_number, Types::String
10
10
  attribute :first_name, Types::String
@@ -12,9 +12,9 @@ module Telegram
12
12
  attribute? :vcard, Types::String
13
13
  attribute? :reply_markup, InlineKeyboardMarkup
14
14
  attribute? :input_message_content, InputMessageContent
15
- attribute? :thumb_url, Types::String
16
- attribute? :thumb_width, Types::Integer
17
- attribute? :thumb_height, Types::Integer
15
+ attribute? :thumbnail_url, Types::String
16
+ attribute? :thumbnail_width, Types::Integer
17
+ attribute? :thumbnail_height, Types::Integer
18
18
  end
19
19
  end
20
20
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultDocument < Base
7
- attribute :type, Types::String.default('document')
7
+ attribute :type, Types::String.constrained(eql: 'document').default('document')
8
8
  attribute :id, Types::String
9
9
  attribute :title, Types::String
10
10
  attribute? :caption, Types::String
@@ -15,9 +15,9 @@ module Telegram
15
15
  attribute? :description, Types::String
16
16
  attribute? :reply_markup, InlineKeyboardMarkup
17
17
  attribute? :input_message_content, InputMessageContent
18
- attribute? :thumb_url, Types::String
19
- attribute? :thumb_width, Types::Integer
20
- attribute? :thumb_height, Types::Integer
18
+ attribute? :thumbnail_url, Types::String
19
+ attribute? :thumbnail_width, Types::Integer
20
+ attribute? :thumbnail_height, Types::Integer
21
21
  end
22
22
  end
23
23
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultGame < Base
7
- attribute :type, Types::String.default('game')
7
+ attribute :type, Types::String.constrained(eql: 'game').default('game')
8
8
  attribute :id, Types::String
9
9
  attribute :game_short_name, Types::String
10
10
  attribute? :reply_markup, InlineKeyboardMarkup
@@ -4,14 +4,14 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultGif < Base
7
- attribute :type, Types::String.default('gif')
7
+ attribute :type, Types::String.constrained(eql: 'gif').default('gif')
8
8
  attribute :id, Types::String
9
9
  attribute :gif_url, Types::String
10
10
  attribute? :gif_width, Types::Integer
11
11
  attribute? :gif_height, Types::Integer
12
12
  attribute? :gif_duration, Types::Integer
13
- attribute :thumb_url, Types::String
14
- attribute? :thumb_mime_type, Types::String
13
+ attribute :thumbnail_url, Types::String
14
+ attribute? :thumbnail_mime_type, Types::String
15
15
  attribute? :title, Types::String
16
16
  attribute? :caption, Types::String
17
17
  attribute? :parse_mode, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultLocation < Base
7
- attribute :type, Types::String.default('location')
7
+ attribute :type, Types::String.constrained(eql: 'location').default('location')
8
8
  attribute :id, Types::String
9
9
  attribute :latitude, Types::Float
10
10
  attribute :longitude, Types::Float
@@ -15,9 +15,9 @@ module Telegram
15
15
  attribute? :proximity_alert_radius, Types::Integer
16
16
  attribute? :reply_markup, InlineKeyboardMarkup
17
17
  attribute? :input_message_content, InputMessageContent
18
- attribute? :thumb_url, Types::String
19
- attribute? :thumb_width, Types::Integer
20
- attribute? :thumb_height, Types::Integer
18
+ attribute? :thumbnail_url, Types::String
19
+ attribute? :thumbnail_width, Types::Integer
20
+ attribute? :thumbnail_height, Types::Integer
21
21
  end
22
22
  end
23
23
  end
@@ -4,14 +4,14 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultMpeg4Gif < Base
7
- attribute :type, Types::String.default('mpeg4_gif')
7
+ attribute :type, Types::String.constrained(eql: 'mpeg4_gif').default('mpeg4_gif')
8
8
  attribute :id, Types::String
9
9
  attribute :mpeg4_url, Types::String
10
10
  attribute? :mpeg4_width, Types::Integer
11
11
  attribute? :mpeg4_height, Types::Integer
12
12
  attribute? :mpeg4_duration, Types::Integer
13
- attribute :thumb_url, Types::String
14
- attribute? :thumb_mime_type, Types::String
13
+ attribute :thumbnail_url, Types::String
14
+ attribute? :thumbnail_mime_type, Types::String
15
15
  attribute? :title, Types::String
16
16
  attribute? :caption, Types::String
17
17
  attribute? :parse_mode, Types::String
@@ -4,10 +4,10 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultPhoto < Base
7
- attribute :type, Types::String.default('photo')
7
+ attribute :type, Types::String.constrained(eql: 'photo').default('photo')
8
8
  attribute :id, Types::String
9
9
  attribute :photo_url, Types::String
10
- attribute :thumb_url, Types::String
10
+ attribute :thumbnail_url, Types::String
11
11
  attribute? :photo_width, Types::Integer
12
12
  attribute? :photo_height, Types::Integer
13
13
  attribute? :title, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultVenue < Base
7
- attribute :type, Types::String.default('venue')
7
+ attribute :type, Types::String.constrained(eql: 'venue').default('venue')
8
8
  attribute :id, Types::String
9
9
  attribute :latitude, Types::Float
10
10
  attribute :longitude, Types::Float
@@ -16,9 +16,9 @@ module Telegram
16
16
  attribute? :google_place_type, Types::String
17
17
  attribute? :reply_markup, InlineKeyboardMarkup
18
18
  attribute? :input_message_content, InputMessageContent
19
- attribute? :thumb_url, Types::String
20
- attribute? :thumb_width, Types::Integer
21
- attribute? :thumb_height, Types::Integer
19
+ attribute? :thumbnail_url, Types::String
20
+ attribute? :thumbnail_width, Types::Integer
21
+ attribute? :thumbnail_height, Types::Integer
22
22
  end
23
23
  end
24
24
  end
@@ -4,11 +4,11 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultVideo < Base
7
- attribute :type, Types::String.default('video')
7
+ attribute :type, Types::String.constrained(eql: 'video').default('video')
8
8
  attribute :id, Types::String
9
9
  attribute :video_url, Types::String
10
10
  attribute :mime_type, Types::String
11
- attribute :thumb_url, Types::String
11
+ attribute :thumbnail_url, Types::String
12
12
  attribute :title, Types::String
13
13
  attribute? :caption, Types::String
14
14
  attribute? :parse_mode, Types::String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultVoice < Base
7
- attribute :type, Types::String.default('voice')
7
+ attribute :type, Types::String.constrained(eql: 'voice').default('voice')
8
8
  attribute :id, Types::String
9
9
  attribute :voice_url, Types::String
10
10
  attribute :title, Types::String
@@ -4,9 +4,9 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaAnimation < Base
7
- attribute :type, Types::String.default('animation')
7
+ attribute :type, Types::String.constrained(eql: 'animation').default('animation')
8
8
  attribute :media, Types::String
9
- attribute? :thumb, Types::String
9
+ attribute? :thumbnail, Types::String
10
10
  attribute? :caption, Types::String
11
11
  attribute? :parse_mode, Types::String
12
12
  attribute? :caption_entities, Types::Array.of(MessageEntity)
@@ -4,9 +4,9 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaAudio < Base
7
- attribute :type, Types::String.default('audio')
7
+ attribute :type, Types::String.constrained(eql: 'audio').default('audio')
8
8
  attribute :media, Types::String
9
- attribute? :thumb, Types::String
9
+ attribute? :thumbnail, Types::String
10
10
  attribute? :caption, Types::String
11
11
  attribute? :parse_mode, Types::String
12
12
  attribute? :caption_entities, Types::Array.of(MessageEntity)
@@ -4,9 +4,9 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaDocument < Base
7
- attribute :type, Types::String.default('document')
7
+ attribute :type, Types::String.constrained(eql: 'document').default('document')
8
8
  attribute :media, Types::String
9
- attribute? :thumb, Types::String
9
+ attribute? :thumbnail, Types::String
10
10
  attribute? :caption, Types::String
11
11
  attribute? :parse_mode, Types::String
12
12
  attribute? :caption_entities, Types::Array.of(MessageEntity)
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaPhoto < Base
7
- attribute :type, Types::String.default('photo')
7
+ attribute :type, Types::String.constrained(eql: 'photo').default('photo')
8
8
  attribute :media, Types::String
9
9
  attribute? :caption, Types::String
10
10
  attribute? :parse_mode, Types::String
@@ -4,9 +4,9 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaVideo < Base
7
- attribute :type, Types::String.default('video')
7
+ attribute :type, Types::String.constrained(eql: 'video').default('video')
8
8
  attribute :media, Types::String
9
- attribute? :thumb, Types::String
9
+ attribute? :thumbnail, Types::String
10
10
  attribute? :caption, Types::String
11
11
  attribute? :parse_mode, Types::String
12
12
  attribute? :caption_entities, Types::Array.of(MessageEntity)
@@ -7,7 +7,7 @@ module Telegram
7
7
  attribute :message_text, Types::String
8
8
  attribute? :parse_mode, Types::String
9
9
  attribute? :entities, Types::Array.of(MessageEntity)
10
- attribute? :disable_web_page_preview, Types::Bool
10
+ attribute? :link_preview_options, LinkPreviewOptions
11
11
  end
12
12
  end
13
13
  end
@@ -5,6 +5,8 @@ module Telegram
5
5
  module Types
6
6
  class KeyboardButton < Base
7
7
  attribute :text, Types::String
8
+ attribute? :request_users, KeyboardButtonRequestUsers
9
+ attribute? :request_chat, KeyboardButtonRequestChat
8
10
  attribute? :request_contact, Types::Bool
9
11
  attribute? :request_location, Types::Bool
10
12
  attribute? :request_poll, KeyboardButtonPollType
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class KeyboardButtonRequestChat < Base
7
+ attribute :request_id, Types::Integer
8
+ attribute :chat_is_channel, Types::Bool
9
+ attribute? :chat_is_forum, Types::Bool
10
+ attribute? :chat_has_username, Types::Bool
11
+ attribute? :chat_is_created, Types::Bool
12
+ attribute? :user_administrator_rights, ChatAdministratorRights
13
+ attribute? :bot_administrator_rights, ChatAdministratorRights
14
+ attribute? :bot_is_member, Types::Bool
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class KeyboardButtonRequestUsers < Base
7
+ attribute :request_id, Types::Integer
8
+ attribute? :user_is_bot, Types::Bool
9
+ attribute? :user_is_premium, Types::Bool
10
+ attribute? :max_quantity, Types::Integer.default(1)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class LinkPreviewOptions < Base
7
+ attribute? :is_disabled, Types::Bool
8
+ attribute? :url, Types::String
9
+ attribute? :prefer_small_media, Types::Bool
10
+ attribute? :prefer_large_media, Types::Bool
11
+ attribute? :show_above_text, Types::Bool
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
+ MaybeInaccessibleMessage = ( # rubocop:disable Naming/ConstantName
7
+ Message |
8
+ InaccessibleMessage
9
+ )
10
+ end
11
+ end
12
+ end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class MenuButtonCommands < Base
7
- attribute :type, Types::String.default('commands')
7
+ attribute :type, Types::String.constrained(eql: 'commands').default('commands')
8
8
  end
9
9
  end
10
10
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class MenuButtonDefault < Base
7
- attribute :type, Types::String.default('default')
7
+ attribute :type, Types::String.constrained(eql: 'default').default('default')
8
8
  end
9
9
  end
10
10
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class MenuButtonWebApp < Base
7
- attribute :type, Types::String.default('web_app')
7
+ attribute :type, Types::String.constrained(eql: 'web_app').default('web_app')
8
8
  attribute :text, Types::String
9
9
  attribute :web_app, WebAppInfo
10
10
  end
@@ -10,33 +10,32 @@ module Telegram
10
10
  attribute? :sender_chat, Chat
11
11
  attribute :date, Types::Integer
12
12
  attribute :chat, Chat
13
- attribute? :forward_from, User
14
- attribute? :forward_from_chat, Chat
15
- attribute? :forward_from_message_id, Types::Integer
16
- attribute? :forward_signature, Types::String
17
- attribute? :forward_sender_name, Types::String
18
- attribute? :forward_date, Types::Integer
19
- attribute? :is_topic_message, Types::Bool
20
- attribute? :is_automatic_forward, Types::Bool
13
+ attribute? :forward_origin, MessageOrigin
14
+ attribute? :is_topic_message, Types::True
15
+ attribute? :is_automatic_forward, Types::True
21
16
  attribute? :reply_to_message, Message
17
+ attribute? :external_reply, ExternalReplyInfo
18
+ attribute? :quote, TextQuote
22
19
  attribute? :via_bot, User
23
20
  attribute? :edit_date, Types::Integer
24
- attribute? :has_protected_content, Types::Bool
21
+ attribute? :has_protected_content, Types::True
25
22
  attribute? :media_group_id, Types::String
26
23
  attribute? :author_signature, Types::String
27
24
  attribute? :text, Types::String
28
25
  attribute? :entities, Types::Array.of(MessageEntity)
26
+ attribute? :link_preview_options, LinkPreviewOptions
29
27
  attribute? :animation, Animation
30
28
  attribute? :audio, Audio
31
29
  attribute? :document, Document
32
30
  attribute? :photo, Types::Array.of(PhotoSize)
33
31
  attribute? :sticker, Sticker
32
+ attribute? :story, Story
34
33
  attribute? :video, Video
35
34
  attribute? :video_note, VideoNote
36
35
  attribute? :voice, Voice
37
36
  attribute? :caption, Types::String
38
37
  attribute? :caption_entities, Types::Array.of(MessageEntity)
39
- attribute? :has_media_spoiler, Types::Bool
38
+ attribute? :has_media_spoiler, Types::True
40
39
  attribute? :contact, Contact
41
40
  attribute? :dice, Dice
42
41
  attribute? :game, Game
@@ -47,16 +46,18 @@ module Telegram
47
46
  attribute? :left_chat_member, User
48
47
  attribute? :new_chat_title, Types::String
49
48
  attribute? :new_chat_photo, Types::Array.of(PhotoSize)
50
- attribute? :delete_chat_photo, Types::Bool
51
- attribute? :group_chat_created, Types::Bool
52
- attribute? :supergroup_chat_created, Types::Bool
53
- attribute? :channel_chat_created, Types::Bool
49
+ attribute? :delete_chat_photo, Types::True
50
+ attribute? :group_chat_created, Types::True
51
+ attribute? :supergroup_chat_created, Types::True
52
+ attribute? :channel_chat_created, Types::True
54
53
  attribute? :message_auto_delete_timer_changed, MessageAutoDeleteTimerChanged
55
54
  attribute? :migrate_to_chat_id, Types::Integer
56
55
  attribute? :migrate_from_chat_id, Types::Integer
57
- attribute? :pinned_message, Message
56
+ attribute? :pinned_message, MaybeInaccessibleMessage
58
57
  attribute? :invoice, Invoice
59
58
  attribute? :successful_payment, SuccessfulPayment
59
+ attribute? :users_shared, UsersShared
60
+ attribute? :chat_shared, ChatShared
60
61
  attribute? :connected_website, Types::String
61
62
  attribute? :write_access_allowed, WriteAccessAllowed
62
63
  attribute? :passport_data, PassportData
@@ -67,6 +68,10 @@ module Telegram
67
68
  attribute? :forum_topic_reopened, ForumTopicReopened
68
69
  attribute? :general_forum_topic_hidden, GeneralForumTopicHidden
69
70
  attribute? :general_forum_topic_unhidden, GeneralForumTopicUnhidden
71
+ attribute? :giveaway_created, GiveawayCreated
72
+ attribute? :giveaway, Giveaway
73
+ attribute? :giveaway_winners, GiveawayWinners
74
+ attribute? :giveaway_completed, GiveawayCompleted
70
75
  attribute? :video_chat_scheduled, VideoChatScheduled
71
76
  attribute? :video_chat_started, VideoChatStarted
72
77
  attribute? :video_chat_ended, VideoChatEnded
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class MessageId < Base
7
+ attribute :message_id, Types::Integer
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ MessageOrigin = ( # rubocop:disable Naming/ConstantName
7
+ MessageOriginUser |
8
+ MessageOriginHiddenUser |
9
+ MessageOriginChat |
10
+ MessageOriginChannel
11
+ )
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class MessageOriginChannel < Base
7
+ attribute :type, Types::String.constrained(eql: 'channel').default('channel')
8
+ attribute :date, Types::Integer
9
+ attribute :chat, Chat
10
+ attribute :message_id, Types::Integer
11
+ attribute? :author_signature, Types::String
12
+ end
13
+ end
14
+ end
15
+ end
@@ -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