telegram-bot-ruby 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +10 -0
  3. data/.github/workflows/ci.yml +0 -3
  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 +10 -0
  9. data/Gemfile +7 -3
  10. data/LICENSE +0 -1
  11. data/README.md +64 -20
  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_member.rb +11 -2
  41. data/lib/telegram/bot/types/chat_member_administrator.rb +8 -5
  42. data/lib/telegram/bot/types/chat_member_banned.rb +2 -2
  43. data/lib/telegram/bot/types/chat_member_left.rb +2 -2
  44. data/lib/telegram/bot/types/chat_member_member.rb +2 -2
  45. data/lib/telegram/bot/types/chat_member_owner.rb +2 -2
  46. data/lib/telegram/bot/types/chat_member_restricted.rb +2 -2
  47. data/lib/telegram/bot/types/chat_member_updated.rb +1 -0
  48. data/lib/telegram/bot/types/compactable.rb +2 -7
  49. data/lib/telegram/bot/types/document.rb +1 -1
  50. data/lib/telegram/bot/types/external_reply_info.rb +33 -0
  51. data/lib/telegram/bot/types/force_reply.rb +1 -1
  52. data/lib/telegram/bot/types/giveaway.rb +18 -0
  53. data/lib/telegram/bot/types/giveaway_completed.rb +13 -0
  54. data/lib/telegram/bot/types/giveaway_created.rb +10 -0
  55. data/lib/telegram/bot/types/giveaway_winners.rb +21 -0
  56. data/lib/telegram/bot/types/inaccessible_message.rb +13 -0
  57. data/lib/telegram/bot/types/inline_keyboard_button.rb +1 -0
  58. data/lib/telegram/bot/types/inline_query_result_article.rb +4 -4
  59. data/lib/telegram/bot/types/inline_query_result_audio.rb +1 -1
  60. data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +1 -1
  61. data/lib/telegram/bot/types/inline_query_result_cached_document.rb +1 -1
  62. data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +1 -1
  63. data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +1 -1
  64. data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +1 -1
  65. data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +1 -1
  66. data/lib/telegram/bot/types/inline_query_result_cached_video.rb +1 -1
  67. data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +1 -1
  68. data/lib/telegram/bot/types/inline_query_result_contact.rb +4 -4
  69. data/lib/telegram/bot/types/inline_query_result_document.rb +4 -4
  70. data/lib/telegram/bot/types/inline_query_result_game.rb +1 -1
  71. data/lib/telegram/bot/types/inline_query_result_gif.rb +3 -3
  72. data/lib/telegram/bot/types/inline_query_result_location.rb +4 -4
  73. data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +3 -3
  74. data/lib/telegram/bot/types/inline_query_result_photo.rb +2 -2
  75. data/lib/telegram/bot/types/inline_query_result_venue.rb +4 -4
  76. data/lib/telegram/bot/types/inline_query_result_video.rb +2 -2
  77. data/lib/telegram/bot/types/inline_query_result_voice.rb +1 -1
  78. data/lib/telegram/bot/types/input_media_animation.rb +2 -2
  79. data/lib/telegram/bot/types/input_media_audio.rb +2 -2
  80. data/lib/telegram/bot/types/input_media_document.rb +2 -2
  81. data/lib/telegram/bot/types/input_media_photo.rb +1 -1
  82. data/lib/telegram/bot/types/input_media_video.rb +2 -2
  83. data/lib/telegram/bot/types/input_text_message_content.rb +1 -1
  84. data/lib/telegram/bot/types/keyboard_button.rb +1 -1
  85. data/lib/telegram/bot/types/{keyboard_button_request_user.rb → keyboard_button_request_users.rb} +2 -1
  86. data/lib/telegram/bot/types/link_preview_options.rb +15 -0
  87. data/lib/telegram/bot/types/maybe_inaccessible_message.rb +12 -0
  88. data/lib/telegram/bot/types/menu_button_commands.rb +1 -1
  89. data/lib/telegram/bot/types/menu_button_default.rb +1 -1
  90. data/lib/telegram/bot/types/menu_button_web_app.rb +1 -1
  91. data/lib/telegram/bot/types/message.rb +19 -16
  92. data/lib/telegram/bot/types/message_id.rb +11 -0
  93. data/lib/telegram/bot/types/message_origin.rb +14 -0
  94. data/lib/telegram/bot/types/message_origin_channel.rb +15 -0
  95. data/lib/telegram/bot/types/message_origin_chat.rb +14 -0
  96. data/lib/telegram/bot/types/message_origin_hidden_user.rb +13 -0
  97. data/lib/telegram/bot/types/message_origin_user.rb +13 -0
  98. data/lib/telegram/bot/types/message_reaction_count_updated.rb +14 -0
  99. data/lib/telegram/bot/types/message_reaction_updated.rb +17 -0
  100. data/lib/telegram/bot/types/passport_element_error_data_field.rb +1 -1
  101. data/lib/telegram/bot/types/passport_element_error_file.rb +1 -1
  102. data/lib/telegram/bot/types/passport_element_error_files.rb +2 -2
  103. data/lib/telegram/bot/types/passport_element_error_front_side.rb +1 -1
  104. data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +1 -1
  105. data/lib/telegram/bot/types/passport_element_error_selfie.rb +1 -1
  106. data/lib/telegram/bot/types/passport_element_error_translation_file.rb +1 -1
  107. data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -2
  108. data/lib/telegram/bot/types/passport_element_error_unspecified.rb +1 -1
  109. data/lib/telegram/bot/types/poll_answer.rb +2 -1
  110. data/lib/telegram/bot/types/reaction_count.rb +12 -0
  111. data/lib/telegram/bot/types/reaction_type.rb +12 -0
  112. data/lib/telegram/bot/types/reaction_type_custom_emoji.rb +12 -0
  113. data/lib/telegram/bot/types/reaction_type_emoji.rb +12 -0
  114. data/lib/telegram/bot/types/reply_keyboard_remove.rb +1 -1
  115. data/lib/telegram/bot/types/reply_parameters.rb +17 -0
  116. data/lib/telegram/bot/types/sticker.rb +2 -1
  117. data/lib/telegram/bot/types/sticker_set.rb +1 -1
  118. data/lib/telegram/bot/types/story.rb +9 -0
  119. data/lib/telegram/bot/types/switch_inline_query_chosen_chat.rb +15 -0
  120. data/lib/telegram/bot/types/text_quote.rb +14 -0
  121. data/lib/telegram/bot/types/update.rb +4 -0
  122. data/lib/telegram/bot/types/user.rb +2 -2
  123. data/lib/telegram/bot/types/user_chat_boosts.rb +11 -0
  124. data/lib/telegram/bot/types/{user_shared.rb → users_shared.rb} +2 -2
  125. data/lib/telegram/bot/types/video.rb +1 -1
  126. data/lib/telegram/bot/types/video_note.rb +1 -1
  127. data/lib/telegram/bot/types/webhook_info.rb +1 -1
  128. data/lib/telegram/bot/types/write_access_allowed.rb +3 -0
  129. data/lib/telegram/bot/version.rb +1 -1
  130. data/lib/telegram/bot.rb +1 -0
  131. data/telegram-bot-ruby.gemspec +1 -4
  132. metadata +43 -5
@@ -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,7 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class KeyboardButton < Base
7
7
  attribute :text, Types::String
8
- attribute? :request_user, KeyboardButtonRequestUser
8
+ attribute? :request_users, KeyboardButtonRequestUsers
9
9
  attribute? :request_chat, KeyboardButtonRequestChat
10
10
  attribute? :request_contact, Types::Bool
11
11
  attribute? :request_location, Types::Bool
@@ -3,10 +3,11 @@
3
3
  module Telegram
4
4
  module Bot
5
5
  module Types
6
- class KeyboardButtonRequestUser < Base
6
+ class KeyboardButtonRequestUsers < Base
7
7
  attribute :request_id, Types::Integer
8
8
  attribute? :user_is_bot, Types::Bool
9
9
  attribute? :user_is_premium, Types::Bool
10
+ attribute? :max_quantity, Types::Integer.default(1)
10
11
  end
11
12
  end
12
13
  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,17 +46,17 @@ 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
60
- attribute? :user_shared, UserShared
59
+ attribute? :users_shared, UsersShared
61
60
  attribute? :chat_shared, ChatShared
62
61
  attribute? :connected_website, Types::String
63
62
  attribute? :write_access_allowed, WriteAccessAllowed
@@ -69,6 +68,10 @@ module Telegram
69
68
  attribute? :forum_topic_reopened, ForumTopicReopened
70
69
  attribute? :general_forum_topic_hidden, GeneralForumTopicHidden
71
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
72
75
  attribute? :video_chat_scheduled, VideoChatScheduled
73
76
  attribute? :video_chat_started, VideoChatStarted
74
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
@@ -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
@@ -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