telegram-bot-ruby 2.0.0 → 2.2.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile +6 -2
  4. data/README.md +1 -1
  5. data/Rakefile +0 -45
  6. data/lib/telegram/bot/api/endpoints.rb +12 -2
  7. data/lib/telegram/bot/client.rb +1 -1
  8. data/lib/telegram/bot/exceptions/response_error.rb +1 -1
  9. data/lib/telegram/bot/types/affiliate_info.rb +15 -0
  10. data/lib/telegram/bot/types/background_fill.rb +16 -0
  11. data/lib/telegram/bot/types/background_fill_freeform_gradient.rb +12 -0
  12. data/lib/telegram/bot/types/background_fill_gradient.rb +14 -0
  13. data/lib/telegram/bot/types/background_fill_solid.rb +12 -0
  14. data/lib/telegram/bot/types/background_type.rb +17 -0
  15. data/lib/telegram/bot/types/background_type_chat_theme.rb +12 -0
  16. data/lib/telegram/bot/types/background_type_fill.rb +13 -0
  17. data/lib/telegram/bot/types/background_type_pattern.rb +16 -0
  18. data/lib/telegram/bot/types/background_type_wallpaper.rb +15 -0
  19. data/lib/telegram/bot/types/birthdate.rb +13 -0
  20. data/lib/telegram/bot/types/bot_command.rb +2 -2
  21. data/lib/telegram/bot/types/bot_command_scope.rb +20 -0
  22. data/lib/telegram/bot/types/business_connection.rb +16 -0
  23. data/lib/telegram/bot/types/business_intro.rb +13 -0
  24. data/lib/telegram/bot/types/business_location.rb +12 -0
  25. data/lib/telegram/bot/types/business_messages_deleted.rb +13 -0
  26. data/lib/telegram/bot/types/business_opening_hours.rb +12 -0
  27. data/lib/telegram/bot/types/business_opening_hours_interval.rb +12 -0
  28. data/lib/telegram/bot/types/chat.rb +0 -28
  29. data/lib/telegram/bot/types/chat_administrator_rights.rb +3 -3
  30. data/lib/telegram/bot/types/chat_background.rb +11 -0
  31. data/lib/telegram/bot/types/chat_boost_added.rb +11 -0
  32. data/lib/telegram/bot/types/chat_boost_source.rb +4 -1
  33. data/lib/telegram/bot/types/chat_boost_source_giveaway.rb +1 -0
  34. data/lib/telegram/bot/types/chat_full_info.rb +54 -0
  35. data/lib/telegram/bot/types/chat_invite_link.rb +2 -0
  36. data/lib/telegram/bot/types/chat_location.rb +1 -1
  37. data/lib/telegram/bot/types/chat_member.rb +4 -4
  38. data/lib/telegram/bot/types/chat_member_administrator.rb +3 -3
  39. data/lib/telegram/bot/types/chat_member_member.rb +1 -0
  40. data/lib/telegram/bot/types/chat_member_updated.rb +1 -0
  41. data/lib/telegram/bot/types/chat_shared.rb +3 -0
  42. data/lib/telegram/bot/types/copy_text_button.rb +11 -0
  43. data/lib/telegram/bot/types/error.rb +14 -0
  44. data/lib/telegram/bot/types/external_reply_info.rb +1 -0
  45. data/lib/telegram/bot/types/force_reply.rb +2 -2
  46. data/lib/telegram/bot/types/gift.rb +15 -0
  47. data/lib/telegram/bot/types/gifts.rb +11 -0
  48. data/lib/telegram/bot/types/giveaway.rb +1 -0
  49. data/lib/telegram/bot/types/giveaway_completed.rb +1 -0
  50. data/lib/telegram/bot/types/giveaway_created.rb +1 -0
  51. data/lib/telegram/bot/types/giveaway_winners.rb +1 -0
  52. data/lib/telegram/bot/types/inline_keyboard_button.rb +2 -1
  53. data/lib/telegram/bot/types/inline_query_result.rb +33 -0
  54. data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +1 -0
  55. data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +1 -0
  56. data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +1 -0
  57. data/lib/telegram/bot/types/inline_query_result_cached_video.rb +1 -0
  58. data/lib/telegram/bot/types/inline_query_result_gif.rb +2 -1
  59. data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +2 -1
  60. data/lib/telegram/bot/types/inline_query_result_photo.rb +1 -0
  61. data/lib/telegram/bot/types/inline_query_result_video.rb +1 -0
  62. data/lib/telegram/bot/types/inline_query_results_button.rb +13 -0
  63. data/lib/telegram/bot/types/input_contact_message_content.rb +1 -1
  64. data/lib/telegram/bot/types/input_invoice_message_content.rb +5 -5
  65. data/lib/telegram/bot/types/input_location_message_content.rb +1 -1
  66. data/lib/telegram/bot/types/input_media.rb +18 -0
  67. data/lib/telegram/bot/types/input_media_animation.rb +1 -0
  68. data/lib/telegram/bot/types/input_media_photo.rb +1 -0
  69. data/lib/telegram/bot/types/input_media_video.rb +1 -0
  70. data/lib/telegram/bot/types/input_message_content.rb +10 -2
  71. data/lib/telegram/bot/types/input_paid_media.rb +15 -0
  72. data/lib/telegram/bot/types/input_paid_media_photo.rb +12 -0
  73. data/lib/telegram/bot/types/input_paid_media_video.rb +17 -0
  74. data/lib/telegram/bot/types/input_poll_option.rb +13 -0
  75. data/lib/telegram/bot/types/input_sticker.rb +15 -0
  76. data/lib/telegram/bot/types/input_text_message_content.rb +2 -2
  77. data/lib/telegram/bot/types/input_venue_message_content.rb +1 -1
  78. data/lib/telegram/bot/types/keyboard_button_request_chat.rb +3 -0
  79. data/lib/telegram/bot/types/keyboard_button_request_users.rb +3 -0
  80. data/lib/telegram/bot/types/location.rb +1 -1
  81. data/lib/telegram/bot/types/maybe_inaccessible_message.rb +4 -1
  82. data/lib/telegram/bot/types/menu_button.rb +16 -0
  83. data/lib/telegram/bot/types/message.rb +11 -0
  84. data/lib/telegram/bot/types/message_origin.rb +4 -1
  85. data/lib/telegram/bot/types/paid_media.rb +16 -0
  86. data/lib/telegram/bot/types/paid_media_info.rb +12 -0
  87. data/lib/telegram/bot/types/paid_media_photo.rb +12 -0
  88. data/lib/telegram/bot/types/paid_media_preview.rb +14 -0
  89. data/lib/telegram/bot/types/paid_media_purchased.rb +12 -0
  90. data/lib/telegram/bot/types/paid_media_video.rb +12 -0
  91. data/lib/telegram/bot/types/passport_element_error.rb +22 -0
  92. data/lib/telegram/bot/types/poll.rb +2 -1
  93. data/lib/telegram/bot/types/poll_option.rb +2 -1
  94. data/lib/telegram/bot/types/prepared_inline_message.rb +12 -0
  95. data/lib/telegram/bot/types/reaction_type.rb +6 -2
  96. data/lib/telegram/bot/types/reaction_type_paid.rb +11 -0
  97. data/lib/telegram/bot/types/refunded_payment.rb +15 -0
  98. data/lib/telegram/bot/types/reply_keyboard_markup.rb +2 -2
  99. data/lib/telegram/bot/types/reply_keyboard_remove.rb +1 -1
  100. data/lib/telegram/bot/types/response_parameters.rb +12 -0
  101. data/lib/telegram/bot/types/revenue_withdrawal_state.rb +16 -0
  102. data/lib/telegram/bot/types/revenue_withdrawal_state_failed.rb +11 -0
  103. data/lib/telegram/bot/types/revenue_withdrawal_state_pending.rb +11 -0
  104. data/lib/telegram/bot/types/revenue_withdrawal_state_succeeded.rb +13 -0
  105. data/lib/telegram/bot/types/shared_user.rb +15 -0
  106. data/lib/telegram/bot/types/star_transaction.rb +16 -0
  107. data/lib/telegram/bot/types/star_transactions.rb +11 -0
  108. data/lib/telegram/bot/types/sticker_set.rb +0 -2
  109. data/lib/telegram/bot/types/story.rb +4 -1
  110. data/lib/telegram/bot/types/successful_payment.rb +3 -0
  111. data/lib/telegram/bot/types/transaction_partner.rb +19 -0
  112. data/lib/telegram/bot/types/transaction_partner_affiliate_program.rb +13 -0
  113. data/lib/telegram/bot/types/transaction_partner_fragment.rb +12 -0
  114. data/lib/telegram/bot/types/transaction_partner_other.rb +11 -0
  115. data/lib/telegram/bot/types/transaction_partner_telegram_ads.rb +11 -0
  116. data/lib/telegram/bot/types/transaction_partner_telegram_api.rb +12 -0
  117. data/lib/telegram/bot/types/transaction_partner_user.rb +18 -0
  118. data/lib/telegram/bot/types/update.rb +5 -0
  119. data/lib/telegram/bot/types/user.rb +2 -0
  120. data/lib/telegram/bot/types/users_shared.rb +1 -1
  121. data/lib/telegram/bot/version.rb +1 -1
  122. data/rakelib/parse_schema.rake +73 -0
  123. data/rakelib/rebuild_types.rake +90 -0
  124. data/rakelib/templates/empty_type.erb +14 -0
  125. data/rakelib/templates/type.erb +13 -0
  126. data/telegram-bot-ruby.gemspec +1 -1
  127. metadata +66 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b61e5af1f53cd133496f945bc7642b2a79e12a1d2be92faca3e45246b51dba5
4
- data.tar.gz: de0024292072dfa7dcc74ffa6c66ba4e30d470652bcdcd5d9b193a8cea66f420
3
+ metadata.gz: c61ae37c189075bf4c60779805815a0eab30f6e06869338741657599a390641c
4
+ data.tar.gz: ebd700271cbc71e7a1e609936e5e6b01bd37eb6190b90266fe9490be77b62138
5
5
  SHA512:
6
- metadata.gz: dab03a9d65d7582dce03bb6f5a8aea981a507f8011e2e618264177182c132c4fda82d1fc80da0590d3196e07e145e586c665af1fa8e9fd5fdfbcd8c36439bad2
7
- data.tar.gz: 1b165086c50ee02e77298c575712551462c58bdb3f963a70ab823d2c9cffffdf23551af8caa3ad484e47bca3d89505f5656ae05c15648b37e6e84cc73e308011
6
+ metadata.gz: 1bc5e6853d97f71863ce7f9010f7a6ee948c37adcaa2f0eeb100f1915d73736c4631c1f6c2d36ec189378f10a6a09186bd4b535dc37b267d8d6f324efbbd8d26
7
+ data.tar.gz: 9e196f0e2709bd705324777f1bd47e0301b407be3a0567ac23f181225d9d1b6e038e787cff2fbac4e5a408446efcd38856d45990d955f76b32d50ff1a606d90f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Added
6
+
7
+ - [Bot API 8.1](https://core.telegram.org/bots/api-changelog#october-31-2024) [#319](https://github.com/atipugin/telegram-bot-ruby/pull/319)
8
+
9
+ ## 2.1.0
10
+
11
+ ### Added
12
+
13
+ - [Bot API 8.0](https://core.telegram.org/bots/api#november-17-2024) (thx [@seorgiy](https://github.com/seorgiy))
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  ### Added
data/Gemfile CHANGED
@@ -12,7 +12,11 @@ gem 'rake', '~> 13.0'
12
12
  gem 'rspec', '~> 3.4'
13
13
  gem 'vcr', '~> 6.0'
14
14
 
15
- gem 'rubocop', '~> 1.54.1'
15
+ gem 'rubocop', '~> 1.66.1'
16
16
  gem 'rubocop-performance', '~> 1.18'
17
17
  gem 'rubocop-rake', '~> 0.6.0'
18
- gem 'rubocop-rspec', '~> 2.22.0'
18
+ gem 'rubocop-rspec', '~> 3.1.0'
19
+
20
+ group :development do
21
+ gem 'openapi3_parser', '~> 0.9.2'
22
+ end
data/README.md CHANGED
@@ -29,7 +29,7 @@ Please make sure it doesn't break your existing code before upgrading to 1.0.
29
29
  Add following line to your Gemfile:
30
30
 
31
31
  ```ruby
32
- gem 'telegram-bot-ruby', '~> 1.0'
32
+ gem 'telegram-bot-ruby', '~> 2.1'
33
33
  ```
34
34
 
35
35
  And then execute:
data/Rakefile CHANGED
@@ -15,48 +15,3 @@ end
15
15
  RSpec::Core::RakeTask.new(:spec)
16
16
 
17
17
  task default: :spec
18
-
19
- desc 'Dump type definitions from docs to YAML'
20
- task :dump_type_attributes do
21
- require_relative 'lib/telegram/bot'
22
- require 'nokogiri'
23
- require 'open-uri'
24
- require 'yaml'
25
-
26
- # Preload every type we have
27
- Zeitwerk::Loader.eager_load_all
28
- types = Telegram::Bot::Types::Base.descendants.map { |c| c.name.split('::').last }
29
-
30
- # Fetch and parse docs
31
- doc = Nokogiri::HTML(URI.open('https://core.telegram.org/bots/api').read)
32
-
33
- next_type_element_names = %w[table h4]
34
-
35
- result = types.to_h do |type|
36
- # This is very hacky but working way to find table containing attributes for
37
- # given type. Basic idea is to find heading with type and then iterate until
38
- # we find table with attributes or next heading (because sometimes type
39
- # doesn't have any attributes).
40
- element = doc.at_xpath(%{//h4[text() = "#{type}"]})
41
- loop do
42
- element = element.next_element
43
- break if next_type_element_names.include?(element.name)
44
- end
45
-
46
- attributes = element.xpath('.//tbody//tr').map do |el|
47
- cells = el.children.select { |c| c.name == 'td' }
48
- {
49
- 'name' => cells[0].text,
50
- 'type' => cells[1].text,
51
- 'required' => !cells[2].text.start_with?('Optional.'),
52
- 'required_value' =>
53
- cells[2].text.match(/^.+, (?:must be (?<found_type>\w+)|always “(?<found_type>\w+)”)$/)&.[](:found_type)
54
- }.compact
55
- end
56
-
57
- [type, attributes]
58
- end
59
-
60
- # Write everything to fixture file
61
- File.write "#{__dir__}/spec/support/type_attributes.yml", result.to_yaml
62
- end
@@ -33,7 +33,7 @@ module Telegram
33
33
  'restrictChatMember' => Types::Bool,
34
34
  'promoteChatMember' => Types::Bool,
35
35
  'leaveChat' => Types::Bool,
36
- 'getChat' => Types::Chat,
36
+ 'getChat' => Types::ChatFullInfo,
37
37
  'getChatAdministrators' => Types::Array.of(Types::ChatMember),
38
38
  'exportChatInviteLink' => Types::String,
39
39
  'setChatPhoto' => Types::Bool,
@@ -107,7 +107,17 @@ module Telegram
107
107
  'setMyDescription' => Types::Bool,
108
108
  'getMyDescription' => Types::BotDescription,
109
109
  'setMyShortDescription' => Types::Bool,
110
- 'getMyShortDescription' => Types::BotShortDescription
110
+ 'getMyShortDescription' => Types::BotShortDescription,
111
+ 'refundStarPayment' => Types::Bool,
112
+ 'getStarTransactions' => Types::StarTransactions,
113
+ 'sendPaidMedia' => Types::Message,
114
+ 'createChatSubscriptionInviteLink' => Types::ChatInviteLink,
115
+ 'editChatSubscriptionInviteLink' => Types::ChatInviteLink,
116
+ 'getAvailableGifts' => Types::Gifts,
117
+ 'sendGift' => Types::Bool,
118
+ 'savePreparedInlineMessage' => Types::PreparedInlineMessage,
119
+ 'editUserStarSubscription' => Types::Bool,
120
+ 'setUserEmojiStatus' => Types::Bool
111
121
  }.freeze
112
122
  end
113
123
  end
@@ -35,7 +35,7 @@ module Telegram
35
35
  yield handle_update(update)
36
36
  end
37
37
  rescue Faraday::TimeoutError, Faraday::ConnectionFailed
38
- retry
38
+ retry if @running
39
39
  end
40
40
 
41
41
  def handle_update(update)
@@ -9,7 +9,7 @@ module Telegram
9
9
  def initialize(response:)
10
10
  @response = response
11
11
 
12
- super "Telegram API has returned the error. (#{data.map { |k, v| %(#{k}: #{v.inspect}) }.join(', ')})"
12
+ super("Telegram API has returned the error. (#{data.map { |k, v| %(#{k}: #{v.inspect}) }.join(', ')})")
13
13
  end
14
14
 
15
15
  def error_code
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class AffiliateInfo < Base
7
+ attribute? :affiliate_user, User
8
+ attribute? :affiliate_chat, Chat
9
+ attribute :commission_per_mille, Types::Integer
10
+ attribute :amount, Types::Integer
11
+ attribute? :nanostar_amount, Types::Integer
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
+ ## Just for classes consistency
7
+ # rubocop:disable Naming/ConstantName
8
+ BackgroundFill = (
9
+ BackgroundFillSolid |
10
+ BackgroundFillGradient |
11
+ BackgroundFillFreeformGradient
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 BackgroundFillFreeformGradient < Base
7
+ attribute :type, Types::String.constrained(eql: 'freeform_gradient').default('freeform_gradient')
8
+ attribute :colors, Types::Array.of(Types::Integer)
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 BackgroundFillGradient < Base
7
+ attribute :type, Types::String.constrained(eql: 'gradient').default('gradient')
8
+ attribute :top_color, Types::Integer
9
+ attribute :bottom_color, Types::Integer
10
+ attribute :rotation_angle, Types::Integer
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class BackgroundFillSolid < Base
7
+ attribute :type, Types::String.constrained(eql: 'solid').default('solid')
8
+ attribute :color, Types::Integer
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
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
+ BackgroundType = (
9
+ BackgroundTypeFill |
10
+ BackgroundTypeWallpaper |
11
+ BackgroundTypePattern |
12
+ BackgroundTypeChatTheme
13
+ )
14
+ # rubocop:enable Naming/ConstantName
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class BackgroundTypeChatTheme < Base
7
+ attribute :type, Types::String.constrained(eql: 'chat_theme').default('chat_theme')
8
+ attribute :theme_name, Types::String
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 BackgroundTypeFill < Base
7
+ attribute :type, Types::String.constrained(eql: 'fill').default('fill')
8
+ attribute :fill, BackgroundFill
9
+ attribute :dark_theme_dimming, Types::Integer
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 BackgroundTypePattern < Base
7
+ attribute :type, Types::String.constrained(eql: 'pattern').default('pattern')
8
+ attribute :document, Document
9
+ attribute :fill, BackgroundFill
10
+ attribute :intensity, Types::Integer
11
+ attribute? :is_inverted, Types::True
12
+ attribute? :is_moving, Types::True
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class BackgroundTypeWallpaper < Base
7
+ attribute :type, Types::String.constrained(eql: 'wallpaper').default('wallpaper')
8
+ attribute :document, Document
9
+ attribute :dark_theme_dimming, Types::Integer
10
+ attribute? :is_blurred, Types::True
11
+ attribute? :is_moving, Types::True
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class Birthdate < Base
7
+ attribute :day, Types::Integer
8
+ attribute :month, Types::Integer
9
+ attribute? :year, Types::Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -4,8 +4,8 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class BotCommand < Base
7
- attribute :command, Types::String
8
- attribute :description, Types::String
7
+ attribute :command, Types::String.constrained(min_size: 1, max_size: 32)
8
+ attribute :description, Types::String.constrained(min_size: 1, max_size: 256)
9
9
  end
10
10
  end
11
11
  end
@@ -0,0 +1,20 @@
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
+ BotCommandScope = (
9
+ BotCommandScopeDefault |
10
+ BotCommandScopeAllPrivateChats |
11
+ BotCommandScopeAllGroupChats |
12
+ BotCommandScopeAllChatAdministrators |
13
+ BotCommandScopeChat |
14
+ BotCommandScopeChatAdministrators |
15
+ BotCommandScopeChatMember
16
+ )
17
+ # rubocop:enable Naming/ConstantName
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class BusinessConnection < Base
7
+ attribute :id, Types::String
8
+ attribute :user, User
9
+ attribute :user_chat_id, Types::Integer
10
+ attribute :date, Types::Integer
11
+ attribute :can_reply, Types::Bool
12
+ attribute :is_enabled, Types::Bool
13
+ end
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 BusinessIntro < Base
7
+ attribute? :title, Types::String
8
+ attribute? :message, Types::String
9
+ attribute? :sticker, Sticker
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 BusinessLocation < Base
7
+ attribute :address, Types::String
8
+ attribute? :location, Location
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 BusinessMessagesDeleted < Base
7
+ attribute :business_connection_id, Types::String
8
+ attribute :chat, Chat
9
+ attribute :message_ids, Types::Array.of(Types::Integer)
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 BusinessOpeningHours < Base
7
+ attribute :time_zone_name, Types::String
8
+ attribute :opening_hours, Types::Array.of(BusinessOpeningHoursInterval)
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 BusinessOpeningHoursInterval < Base
7
+ attribute :opening_minute, Types::Integer
8
+ attribute :closing_minute, Types::Integer
9
+ end
10
+ end
11
+ end
12
+ end
@@ -11,34 +11,6 @@ module Telegram
11
11
  attribute? :first_name, Types::String
12
12
  attribute? :last_name, Types::String
13
13
  attribute? :is_forum, Types::True
14
- attribute? :photo, ChatPhoto
15
- attribute? :active_usernames, Types::Array.of(Types::String)
16
- attribute? :available_reactions, Types::Array.of(ReactionType)
17
- attribute? :accent_color_id, Types::Integer
18
- attribute? :background_custom_emoji_id, Types::String
19
- attribute? :profile_accent_color_id, Types::Integer
20
- attribute? :profile_background_custom_emoji_id, Types::String
21
- attribute? :emoji_status_custom_emoji_id, Types::String
22
- attribute? :emoji_status_expiration_date, Types::Integer
23
- attribute? :bio, Types::String
24
- attribute? :has_private_forwards, Types::True
25
- attribute? :has_restricted_voice_and_video_messages, Types::True
26
- attribute? :join_to_send_messages, Types::True
27
- attribute? :join_by_request, Types::True
28
- attribute? :description, Types::String
29
- attribute? :invite_link, Types::String
30
- attribute? :pinned_message, Message
31
- attribute? :permissions, ChatPermissions
32
- attribute? :slow_mode_delay, Types::Integer
33
- attribute? :message_auto_delete_time, Types::Integer
34
- attribute? :has_aggressive_anti_spam_enabled, Types::True
35
- attribute? :has_hidden_members, Types::True
36
- attribute? :has_protected_content, Types::True
37
- attribute? :has_visible_history, Types::True
38
- attribute? :sticker_set_name, Types::String
39
- attribute? :can_set_sticker_set, Types::True
40
- attribute? :linked_chat_id, Types::Integer
41
- attribute? :location, ChatLocation
42
14
  end
43
15
  end
44
16
  end
@@ -12,12 +12,12 @@ module Telegram
12
12
  attribute :can_promote_members, Types::Bool
13
13
  attribute :can_change_info, Types::Bool
14
14
  attribute :can_invite_users, Types::Bool
15
+ attribute :can_post_stories, Types::Bool
16
+ attribute :can_edit_stories, Types::Bool
17
+ attribute :can_delete_stories, Types::Bool
15
18
  attribute? :can_post_messages, Types::Bool
16
19
  attribute? :can_edit_messages, Types::Bool
17
20
  attribute? :can_pin_messages, Types::Bool
18
- attribute? :can_post_stories, Types::Bool
19
- attribute? :can_edit_stories, Types::Bool
20
- attribute? :can_delete_stories, Types::Bool
21
21
  attribute? :can_manage_topics, Types::Bool
22
22
  end
23
23
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ChatBackground < Base
7
+ attribute :type, BackgroundType
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ChatBoostAdded < Base
7
+ attribute :boost_count, Types::Integer
8
+ end
9
+ end
10
+ end
11
+ end
@@ -3,11 +3,14 @@
3
3
  module Telegram
4
4
  module Bot
5
5
  module Types
6
- ChatBoostSource = ( # rubocop:disable Naming/ConstantName
6
+ ## Just for classes consistency
7
+ # rubocop:disable Naming/ConstantName
8
+ ChatBoostSource = (
7
9
  ChatBoostSourcePremium |
8
10
  ChatBoostSourceGiftCode |
9
11
  ChatBoostSourceGiveaway
10
12
  )
13
+ # rubocop:enable Naming/ConstantName
11
14
  end
12
15
  end
13
16
  end
@@ -7,6 +7,7 @@ module Telegram
7
7
  attribute :source, Types::String.constrained(eql: 'giveaway').default('giveaway')
8
8
  attribute :giveaway_message_id, Types::Integer
9
9
  attribute? :user, User
10
+ attribute? :prize_star_count, Types::Integer
10
11
  attribute? :is_unclaimed, Types::True
11
12
  end
12
13
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ChatFullInfo < Base
7
+ attribute :id, Types::Integer
8
+ attribute :type, Types::String
9
+ attribute? :title, Types::String
10
+ attribute? :username, Types::String
11
+ attribute? :first_name, Types::String
12
+ attribute? :last_name, Types::String
13
+ attribute? :is_forum, Types::True
14
+ attribute :accent_color_id, Types::Integer
15
+ attribute :max_reaction_count, Types::Integer
16
+ attribute? :photo, ChatPhoto
17
+ attribute? :active_usernames, Types::Array.of(Types::String)
18
+ attribute? :birthdate, Birthdate
19
+ attribute? :business_intro, BusinessIntro
20
+ attribute? :business_location, BusinessLocation
21
+ attribute? :business_opening_hours, BusinessOpeningHours
22
+ attribute? :personal_chat, Chat
23
+ attribute? :available_reactions, Types::Array.of(ReactionType)
24
+ attribute? :background_custom_emoji_id, Types::String
25
+ attribute? :profile_accent_color_id, Types::Integer
26
+ attribute? :profile_background_custom_emoji_id, Types::String
27
+ attribute? :emoji_status_custom_emoji_id, Types::String
28
+ attribute? :emoji_status_expiration_date, Types::Integer
29
+ attribute? :bio, Types::String
30
+ attribute? :has_private_forwards, Types::True
31
+ attribute? :has_restricted_voice_and_video_messages, Types::True
32
+ attribute? :join_to_send_messages, Types::True
33
+ attribute? :join_by_request, Types::True
34
+ attribute? :description, Types::String
35
+ attribute? :invite_link, Types::String
36
+ attribute? :pinned_message, Message
37
+ attribute? :permissions, ChatPermissions
38
+ attribute? :can_send_paid_media, Types::True
39
+ attribute? :slow_mode_delay, Types::Integer
40
+ attribute? :unrestrict_boost_count, Types::Integer
41
+ attribute? :message_auto_delete_time, Types::Integer
42
+ attribute? :has_aggressive_anti_spam_enabled, Types::True
43
+ attribute? :has_hidden_members, Types::True
44
+ attribute? :has_protected_content, Types::True
45
+ attribute? :has_visible_history, Types::True
46
+ attribute? :sticker_set_name, Types::String
47
+ attribute? :can_set_sticker_set, Types::True
48
+ attribute? :custom_emoji_sticker_set_name, Types::String
49
+ attribute? :linked_chat_id, Types::Integer
50
+ attribute? :location, ChatLocation
51
+ end
52
+ end
53
+ end
54
+ end
@@ -13,6 +13,8 @@ module Telegram
13
13
  attribute? :expire_date, Types::Integer
14
14
  attribute? :member_limit, Types::Integer
15
15
  attribute? :pending_join_request_count, Types::Integer
16
+ attribute? :subscription_period, Types::Integer
17
+ attribute? :subscription_price, Types::Integer
16
18
  end
17
19
  end
18
20
  end
@@ -5,7 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class ChatLocation < Base
7
7
  attribute :location, Location
8
- attribute :address, Types::String
8
+ attribute :address, Types::String.constrained(min_size: 1, max_size: 64)
9
9
  end
10
10
  end
11
11
  end
@@ -6,12 +6,12 @@ module Telegram
6
6
  ## Just for classes consistency
7
7
  # rubocop:disable Naming/ConstantName
8
8
  ChatMember = (
9
+ ChatMemberOwner |
9
10
  ChatMemberAdministrator |
10
- ChatMemberBanned |
11
- ChatMemberLeft |
12
11
  ChatMemberMember |
13
- ChatMemberOwner |
14
- ChatMemberRestricted
12
+ ChatMemberRestricted |
13
+ ChatMemberLeft |
14
+ ChatMemberBanned
15
15
  )
16
16
  # rubocop:enable Naming/ConstantName
17
17
  end
@@ -15,12 +15,12 @@ module Telegram
15
15
  attribute :can_promote_members, Types::Bool
16
16
  attribute :can_change_info, Types::Bool
17
17
  attribute :can_invite_users, Types::Bool
18
+ attribute :can_post_stories, Types::Bool
19
+ attribute :can_edit_stories, Types::Bool
20
+ attribute :can_delete_stories, Types::Bool
18
21
  attribute? :can_post_messages, Types::Bool
19
22
  attribute? :can_edit_messages, Types::Bool
20
23
  attribute? :can_pin_messages, Types::Bool
21
- attribute? :can_post_stories, Types::Bool
22
- attribute? :can_edit_stories, Types::Bool
23
- attribute? :can_delete_stories, Types::Bool
24
24
  attribute? :can_manage_topics, Types::Bool
25
25
  attribute? :custom_title, Types::String
26
26
  end