telegram-bot-ruby 0.16.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -3
  3. data/CHANGELOG.md +18 -0
  4. data/Gemfile +2 -0
  5. data/Rakefile +3 -1
  6. data/examples/bot.rb +2 -0
  7. data/lib/telegram/bot/api.rb +11 -5
  8. data/lib/telegram/bot/client.rb +4 -3
  9. data/lib/telegram/bot/configuration.rb +5 -1
  10. data/lib/telegram/bot/exceptions/base.rb +2 -0
  11. data/lib/telegram/bot/exceptions/response_error.rb +3 -0
  12. data/lib/telegram/bot/exceptions.rb +2 -0
  13. data/lib/telegram/bot/null_logger.rb +3 -1
  14. data/lib/telegram/bot/types/animation.rb +2 -0
  15. data/lib/telegram/bot/types/audio.rb +2 -0
  16. data/lib/telegram/bot/types/base.rb +2 -0
  17. data/lib/telegram/bot/types/bot_command.rb +12 -0
  18. data/lib/telegram/bot/types/bot_command_scope_all_chat_administrators.rb +11 -0
  19. data/lib/telegram/bot/types/bot_command_scope_all_group_chats.rb +11 -0
  20. data/lib/telegram/bot/types/bot_command_scope_all_private_chats.rb +11 -0
  21. data/lib/telegram/bot/types/bot_command_scope_chat.rb +12 -0
  22. data/lib/telegram/bot/types/bot_command_scope_chat_administrators.rb +12 -0
  23. data/lib/telegram/bot/types/bot_command_scope_chat_member.rb +13 -0
  24. data/lib/telegram/bot/types/bot_command_scope_default.rb +11 -0
  25. data/lib/telegram/bot/types/callback_game.rb +2 -0
  26. data/lib/telegram/bot/types/callback_query.rb +2 -0
  27. data/lib/telegram/bot/types/chat.rb +9 -1
  28. data/lib/telegram/bot/types/chat_administrator_rights.rb +21 -0
  29. data/lib/telegram/bot/types/chat_invite_link.rb +5 -0
  30. data/lib/telegram/bot/types/chat_join_request.rb +15 -0
  31. data/lib/telegram/bot/types/chat_location.rb +2 -0
  32. data/lib/telegram/bot/types/chat_member.rb +3 -1
  33. data/lib/telegram/bot/types/chat_member_updated.rb +2 -0
  34. data/lib/telegram/bot/types/chat_permissions.rb +2 -0
  35. data/lib/telegram/bot/types/chat_photo.rb +2 -0
  36. data/lib/telegram/bot/types/chosen_inline_result.rb +2 -0
  37. data/lib/telegram/bot/types/compactable.rb +4 -2
  38. data/lib/telegram/bot/types/contact.rb +2 -0
  39. data/lib/telegram/bot/types/dice.rb +2 -0
  40. data/lib/telegram/bot/types/document.rb +2 -0
  41. data/lib/telegram/bot/types/encrypted_credentials.rb +2 -0
  42. data/lib/telegram/bot/types/encrypted_passport_element.rb +2 -0
  43. data/lib/telegram/bot/types/file.rb +2 -0
  44. data/lib/telegram/bot/types/force_reply.rb +3 -0
  45. data/lib/telegram/bot/types/game.rb +2 -0
  46. data/lib/telegram/bot/types/game_high_score.rb +2 -0
  47. data/lib/telegram/bot/types/inline_keyboard_button.rb +4 -1
  48. data/lib/telegram/bot/types/inline_keyboard_markup.rb +2 -0
  49. data/lib/telegram/bot/types/inline_query.rb +4 -1
  50. data/lib/telegram/bot/types/inline_query_result_article.rb +2 -0
  51. data/lib/telegram/bot/types/inline_query_result_audio.rb +2 -0
  52. data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +2 -0
  53. data/lib/telegram/bot/types/inline_query_result_cached_document.rb +2 -0
  54. data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +2 -0
  55. data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +2 -0
  56. data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +2 -0
  57. data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +2 -0
  58. data/lib/telegram/bot/types/inline_query_result_cached_video.rb +2 -0
  59. data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +2 -0
  60. data/lib/telegram/bot/types/inline_query_result_contact.rb +2 -0
  61. data/lib/telegram/bot/types/inline_query_result_document.rb +2 -0
  62. data/lib/telegram/bot/types/inline_query_result_game.rb +2 -0
  63. data/lib/telegram/bot/types/inline_query_result_gif.rb +2 -0
  64. data/lib/telegram/bot/types/inline_query_result_location.rb +2 -0
  65. data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +2 -0
  66. data/lib/telegram/bot/types/inline_query_result_photo.rb +2 -0
  67. data/lib/telegram/bot/types/inline_query_result_venue.rb +2 -0
  68. data/lib/telegram/bot/types/inline_query_result_video.rb +2 -0
  69. data/lib/telegram/bot/types/inline_query_result_voice.rb +2 -0
  70. data/lib/telegram/bot/types/input_contact_message_content.rb +2 -0
  71. data/lib/telegram/bot/types/input_invoice_message_content.rb +30 -0
  72. data/lib/telegram/bot/types/input_location_message_content.rb +2 -0
  73. data/lib/telegram/bot/types/input_media_animation.rb +2 -0
  74. data/lib/telegram/bot/types/input_media_audio.rb +2 -0
  75. data/lib/telegram/bot/types/input_media_document.rb +2 -0
  76. data/lib/telegram/bot/types/input_media_photo.rb +2 -0
  77. data/lib/telegram/bot/types/input_media_video.rb +2 -0
  78. data/lib/telegram/bot/types/input_message_content.rb +2 -0
  79. data/lib/telegram/bot/types/input_text_message_content.rb +2 -0
  80. data/lib/telegram/bot/types/input_venue_message_content.rb +2 -0
  81. data/lib/telegram/bot/types/invoice.rb +2 -0
  82. data/lib/telegram/bot/types/keyboard_button.rb +3 -0
  83. data/lib/telegram/bot/types/keyboard_button_poll_type.rb +2 -0
  84. data/lib/telegram/bot/types/labeled_price.rb +2 -0
  85. data/lib/telegram/bot/types/location.rb +2 -0
  86. data/lib/telegram/bot/types/login_url.rb +2 -0
  87. data/lib/telegram/bot/types/mask_position.rb +2 -0
  88. data/lib/telegram/bot/types/menu_button_commands.rb +11 -0
  89. data/lib/telegram/bot/types/menu_button_default.rb +11 -0
  90. data/lib/telegram/bot/types/menu_button_web_app.rb +13 -0
  91. data/lib/telegram/bot/types/message.rb +15 -9
  92. data/lib/telegram/bot/types/message_auto_delete_timer_changed.rb +2 -0
  93. data/lib/telegram/bot/types/message_entity.rb +2 -0
  94. data/lib/telegram/bot/types/order_info.rb +2 -0
  95. data/lib/telegram/bot/types/passport_data.rb +2 -0
  96. data/lib/telegram/bot/types/passport_element_error_data_field.rb +2 -0
  97. data/lib/telegram/bot/types/passport_element_error_file.rb +2 -0
  98. data/lib/telegram/bot/types/passport_element_error_files.rb +2 -0
  99. data/lib/telegram/bot/types/passport_element_error_front_side.rb +2 -0
  100. data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +2 -0
  101. data/lib/telegram/bot/types/passport_element_error_selfie.rb +2 -0
  102. data/lib/telegram/bot/types/passport_element_error_translation_file.rb +2 -0
  103. data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -0
  104. data/lib/telegram/bot/types/passport_element_error_unspecified.rb +2 -0
  105. data/lib/telegram/bot/types/passport_file.rb +2 -0
  106. data/lib/telegram/bot/types/pattern_matching.rb +2 -0
  107. data/lib/telegram/bot/types/photo_size.rb +2 -0
  108. data/lib/telegram/bot/types/poll.rb +2 -0
  109. data/lib/telegram/bot/types/poll_answer.rb +2 -0
  110. data/lib/telegram/bot/types/poll_option.rb +2 -0
  111. data/lib/telegram/bot/types/pre_checkout_query.rb +2 -0
  112. data/lib/telegram/bot/types/proximity_alert_triggered.rb +2 -0
  113. data/lib/telegram/bot/types/reply_keyboard_markup.rb +3 -0
  114. data/lib/telegram/bot/types/reply_keyboard_remove.rb +2 -0
  115. data/lib/telegram/bot/types/sent_web_app_message.rb +11 -0
  116. data/lib/telegram/bot/types/shipping_address.rb +2 -0
  117. data/lib/telegram/bot/types/shipping_option.rb +2 -0
  118. data/lib/telegram/bot/types/shipping_query.rb +2 -0
  119. data/lib/telegram/bot/types/sticker.rb +3 -0
  120. data/lib/telegram/bot/types/sticker_set.rb +3 -0
  121. data/lib/telegram/bot/types/successful_payment.rb +2 -0
  122. data/lib/telegram/bot/types/update.rb +3 -0
  123. data/lib/telegram/bot/types/user.rb +2 -0
  124. data/lib/telegram/bot/types/user_profile_photos.rb +2 -0
  125. data/lib/telegram/bot/types/venue.rb +2 -0
  126. data/lib/telegram/bot/types/video.rb +2 -0
  127. data/lib/telegram/bot/types/{voice_chat_ended.rb → video_chat_ended.rb} +3 -1
  128. data/lib/telegram/bot/types/{voice_chat_participants_invited.rb → video_chat_participants_invited.rb} +3 -1
  129. data/lib/telegram/bot/types/video_chat_scheduled.rb +11 -0
  130. data/lib/telegram/bot/types/{voice_chat_started.rb → video_chat_started.rb} +3 -1
  131. data/lib/telegram/bot/types/video_note.rb +2 -0
  132. data/lib/telegram/bot/types/voice.rb +2 -0
  133. data/lib/telegram/bot/types/web_app_data.rb +12 -0
  134. data/lib/telegram/bot/types/web_app_info.rb +11 -0
  135. data/lib/telegram/bot/types/webhook_info.rb +3 -1
  136. data/lib/telegram/bot/types.rb +25 -5
  137. data/lib/telegram/bot/version.rb +3 -1
  138. data/lib/telegram/bot.rb +2 -0
  139. data/telegram-bot-ruby.gemspec +9 -6
  140. metadata +55 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6227a7eff23e7037a7e07e021a4f2925681c952a449b99a38cd5c23b3f331c5c
4
- data.tar.gz: a1bc35c582ff1ba5fe4627613e6c71454be8c11877a5a1fdca7ca300a1a1fead
3
+ metadata.gz: f4a3f55636b586f9c0c40a020c0eec4686fe4c664946dcb560422c3082d82b6c
4
+ data.tar.gz: c44b6c28251b3183e5b3bb7256851d0b92f638bcc24b2fd4a188c21aa28beeca
5
5
  SHA512:
6
- metadata.gz: 39ff75cc41a8fcfa5558a28cedb8e9f3b4be72e40fca71a4f8a9a1493bcd67850c6598e84882b2db7edee2c46202b72756d1612f477909fc1097211d7a95f1da
7
- data.tar.gz: fb29319e282a3b851689503657f1877511555b10be4135bc9c99ad192093c3ea7f96e352a32bb2cb50bedc5dd206944f2604d135b15a9375a678186c244c385b
6
+ metadata.gz: 31c46eeb60c9c176ba58ba42811968e5c7b7db40849024f1626147f482c06a4e884843ed228a0a8391feeb69682521bec80d92ebac5fdb531dbadaa386193239
7
+ data.tar.gz: e3ec13011270299788f4e3e0329c98f9186621b669961e8c669d82a974b1579bf023f70f643071b4eefd5ceec69ebede0ff733cc935e207a2bcaaad9417b9b2e
data/.rubocop.yml CHANGED
@@ -1,15 +1,20 @@
1
1
  ---
2
- require: rubocop-rspec
2
+ require:
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+
6
+ AllCops:
7
+ NewCops: enable
3
8
 
4
9
  Style/Documentation:
5
10
  Enabled: false
6
11
 
7
12
  Metrics/BlockLength:
8
- ExcludedMethods:
13
+ IgnoredMethods:
9
14
  - context
10
15
  - describe
11
16
 
12
- Metrics/LineLength:
17
+ Layout/LineLength:
13
18
  Max: 120
14
19
  Exclude:
15
20
  - telegram-bot-ruby.gemspec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.0
4
+
5
+ - Implement [Bot API 6.0](https://core.telegram.org/bots/api-changelog#april-16-2022)
6
+ - Update rubocop
7
+
8
+ ## 0.18.0
9
+
10
+ - Implement [Bot API 5.2](https://core.telegram.org/bots/api-changelog#april-26-2021)
11
+ - Implement [Bot API 5.3](https://core.telegram.org/bots/api-changelog#june-25-2021)
12
+ - Implement [Bot API 5.4](https://core.telegram.org/bots/api-changelog#november-5-2021)
13
+ - Implement [Bot API 5.5](https://core.telegram.org/bots/api-changelog#december-7-2021)
14
+ - Implement [Bot API 5.6](https://core.telegram.org/bots/api-changelog#december-30-2021)
15
+ - Implement [Bot API 5.7](https://core.telegram.org/bots/api-changelog#january-31-2022)
16
+
17
+ ## 0.17.0
18
+
19
+ - Pin `faraday` to 1.0
20
+
3
21
  ## 0.16.0
4
22
 
5
23
  - Replace `inflecto` with `dry-inflector`
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'bundler/setup'
3
5
  require 'rubocop/rake_task'
@@ -6,7 +8,7 @@ require 'rspec/core/rake_task'
6
8
  RuboCop::RakeTask.new(:rubocop) do |task|
7
9
  task.fail_on_error = false
8
10
  task.options = %w[--force-exclusion]
9
- task.patterns = %w[lib/**/*.rb]
11
+ task.patterns = %w[{lib,spec}/**/*.rb Rakefile]
10
12
  task.requires << 'rubocop-rspec'
11
13
  end
12
14
 
data/examples/bot.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'telegram/bot'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  class Api
@@ -19,8 +21,10 @@ module Telegram
19
21
  sendGame setGameScore getGameHighScores setPassportDataErrors
20
22
  editMessageMedia sendAnimation sendPoll stopPoll setChatPermissions
21
23
  setChatAdministratorCustomTitle sendDice getMyCommands setMyCommands
22
- setStickerSetThumb logOut close copyMessage createChatInviteLink
23
- editChatInviteLink revokeChatInviteLink
24
+ deleteMyCommands setStickerSetThumb logOut close copyMessage
25
+ createChatInviteLink editChatInviteLink revokeChatInviteLink
26
+ approveChatJoinRequest declineChatJoinRequest banChatSenderChat
27
+ unbanChatSenderChat
24
28
  ].freeze
25
29
 
26
30
  attr_reader :token, :url
@@ -57,9 +61,9 @@ module Telegram
57
61
 
58
62
  private
59
63
 
60
- def build_params(h)
61
- h.each_with_object({}) do |(key, value), params|
62
- params[key] = sanitize_value(value)
64
+ def build_params(params)
65
+ params.transform_values do |value|
66
+ sanitize_value(value)
63
67
  end
64
68
  end
65
69
 
@@ -86,6 +90,8 @@ module Telegram
86
90
  faraday.request :multipart
87
91
  faraday.request :url_encoded
88
92
  faraday.adapter Telegram::Bot.configuration.adapter
93
+ faraday.options.timeout = Telegram::Bot.configuration.timeout
94
+ faraday.options.open_timeout = Telegram::Bot.configuration.open_timeout
89
95
  end
90
96
  end
91
97
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  class Client
@@ -33,7 +35,7 @@ module Telegram
33
35
  response['result'].each do |data|
34
36
  yield handle_update(Types::Update.new(data))
35
37
  end
36
- rescue Faraday::TimeoutError
38
+ rescue Faraday::TimeoutError, Faraday::ConnectionFailed
37
39
  retry
38
40
  end
39
41
 
@@ -50,7 +52,6 @@ module Telegram
50
52
  def default_options
51
53
  {
52
54
  offset: 0,
53
- timeout: 20,
54
55
  logger: NullLogger.new,
55
56
  url: 'https://api.telegram.org'
56
57
  }
@@ -59,7 +60,7 @@ module Telegram
59
60
  def log_incoming_message(message)
60
61
  uid = message.respond_to?(:from) && message.from ? message.from.id : nil
61
62
  logger.info(
62
- format('Incoming message: text="%s" uid=%s', message, uid)
63
+ format('Incoming message: text="%<text>s" uid=%<uid>s', message: message, uid: uid)
63
64
  )
64
65
  end
65
66
  end
@@ -1,10 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  class Configuration
4
- attr_accessor :adapter
6
+ attr_accessor :adapter, :open_timeout, :timeout
5
7
 
6
8
  def initialize
7
9
  @adapter = Faraday.default_adapter
10
+ @open_timeout = 20
11
+ @timeout = 20
8
12
  end
9
13
  end
10
14
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Exceptions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Exceptions
@@ -6,6 +8,7 @@ module Telegram
6
8
 
7
9
  def initialize(response)
8
10
  @response = response
11
+ super
9
12
  end
10
13
 
11
14
  def to_s
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'telegram/bot/exceptions/base'
2
4
  require 'telegram/bot/exceptions/response_error'
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  class NullLogger < Logger
4
- def initialize(*); end
6
+ def initialize(*); end # rubocop:disable Lint/MissingSuper
5
7
 
6
8
  def add(*); end
7
9
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class BotCommand < Base
7
+ attribute :command, String
8
+ attribute :description, String
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class BotCommandScopeAllChatAdministrators < Base
7
+ attribute :type, String, default: 'all_chat_administrators'
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 BotCommandScopeAllGroupChats < Base
7
+ attribute :type, String, default: 'all_group_chats'
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 BotCommandScopeAllPrivateChats < Base
7
+ attribute :type, String, default: 'all_private_chats'
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 BotCommandScopeChat < Base
7
+ attribute :type, String, default: 'chat'
8
+ attribute :chat_id, 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 BotCommandScopeChatAdministrators < Base
7
+ attribute :type, String, default: 'chat_administrators'
8
+ attribute :chat_id, 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 BotCommandScopeChatMember < Base
7
+ attribute :type, String, default: 'chat_member'
8
+ attribute :chat_id, String
9
+ attribute :user_id, Integer
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 BotCommandScopeDefault < Base
7
+ attribute :type, String, default: 'default'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -12,15 +14,21 @@ module Telegram
12
14
  attribute :username, String
13
15
  attribute :first_name, String
14
16
  attribute :last_name, String
15
- attribute :all_members_are_administrators, Boolean
16
17
  attribute :photo, ChatPhoto
18
+ attribute :bio, String
19
+ attribute :has_private_forwards, Boolean
17
20
  attribute :description, String
18
21
  attribute :invite_link, String
19
22
  attribute :pinned_message, 'Telegram::Bot::Types::Message'
20
23
  attribute :permissions, ChatPermissions
21
24
  attribute :slow_mode_delay, Integer
25
+ attribute :message_auto_delete_time, Integer
26
+ attribute :has_protected_content, Boolean
22
27
  attribute :sticker_set_name, String
23
28
  attribute :can_set_sticker_set, Boolean
29
+ attribute :all_members_are_administrators, Boolean
30
+ attribute :linked_chat_id, Integer
31
+ attribute :location, ChatLocation
24
32
  end
25
33
  end
26
34
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ChatAdministratorRight < Base
7
+ attribute :is_anonymous, Boolean
8
+ attribute :can_manage_chat, Boolean
9
+ attribute :can_delete_messages, Boolean
10
+ attribute :can_manage_video_chats, Boolean
11
+ attribute :can_restrict_members, Boolean
12
+ attribute :can_promote_members, Boolean
13
+ attribute :can_change_info, Boolean
14
+ attribute :can_invite_users, Boolean
15
+ attribute :can_post_messages, Boolean
16
+ attribute :can_edit_messages, Boolean
17
+ attribute :can_pin_messages, Boolean
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,13 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class ChatInviteLink < Base
5
7
  attribute :invite_link, String
6
8
  attribute :creator, User
9
+ attribute :creates_join_request, Boolean
7
10
  attribute :is_primary, Boolean
8
11
  attribute :is_revoked, Boolean
12
+ attribute :name, String
9
13
  attribute :expire_date, Integer
10
14
  attribute :member_limit, Integer
15
+ attribute :pending_join_request_count, Integer
11
16
  end
12
17
  end
13
18
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ChatJoinRequest < Base
7
+ attribute :chat, Chat
8
+ attribute :from, User
9
+ attribute :date, Integer
10
+ attribute :bio, String
11
+ attribute :invite_link, ChatInviteLink
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -11,7 +13,7 @@ module Telegram
11
13
  attribute :can_post_messages, Boolean
12
14
  attribute :can_edit_messages, Boolean
13
15
  attribute :can_delete_messages, Boolean
14
- attribute :can_manage_voice_chats, Boolean
16
+ attribute :can_manage_video_chats, Boolean
15
17
  attribute :can_restrict_members, Boolean
16
18
  attribute :can_promote_members, Boolean
17
19
  attribute :can_change_info, Boolean
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  module Compactable
5
7
  def to_compact_hash
6
- Hash[attributes.dup.delete_if { |_, v| v.nil? }.map do |key, value|
8
+ attributes.dup.delete_if { |_, v| v.nil? }.map do |key, value|
7
9
  value =
8
10
  if value.respond_to?(:to_compact_hash)
9
11
  value.to_compact_hash
@@ -12,7 +14,7 @@ module Telegram
12
14
  end
13
15
 
14
16
  [key, value]
15
- end]
17
+ end.to_h
16
18
  end
17
19
 
18
20
  def to_json(*args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class ForceReply < Base
5
7
  attribute :force_reply, Boolean
8
+ attribute :input_field_placeholder, String
6
9
  attribute :selective, Boolean, default: false
7
10
  end
8
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class InlineKeyboardButton < Base
5
7
  attribute :text, String
6
8
  attribute :url, String
7
- attribute :login_url, LoginUrl
8
9
  attribute :callback_data, String
10
+ attribute :web_app, WebAppInfo
11
+ attribute :login_url, LoginUrl
9
12
  attribute :switch_inline_query, String
10
13
  attribute :switch_inline_query_current_chat, String
11
14
  attribute :callback_game, CallbackGame
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,12 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class InlineQuery < Base
5
7
  attribute :id, String
6
8
  attribute :from, User
7
- attribute :location, Location
8
9
  attribute :query, String
9
10
  attribute :offset, String
11
+ attribute :chat_type, String
12
+ attribute :location, Location
10
13
 
11
14
  alias to_s query
12
15
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types