telegram-bot-ruby 2.5.0 → 2.7.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/skills/update-api/SKILL.md +70 -0
  3. data/.github/workflows/ci.yml +4 -2
  4. data/.gitignore +1 -0
  5. data/CHANGELOG.md +15 -0
  6. data/Gemfile +1 -1
  7. data/README.md +40 -23
  8. data/lib/telegram/bot/api/endpoints.rb +13 -2
  9. data/lib/telegram/bot/api.rb +13 -1
  10. data/lib/telegram/bot/configuration.rb +2 -1
  11. data/lib/telegram/bot/types/accepted_gift_types.rb +1 -0
  12. data/lib/telegram/bot/types/callback_query.rb +4 -0
  13. data/lib/telegram/bot/types/chat_administrator_rights.rb +1 -0
  14. data/lib/telegram/bot/types/chat_full_info.rb +4 -0
  15. data/lib/telegram/bot/types/chat_member_administrator.rb +1 -0
  16. data/lib/telegram/bot/types/chat_member_member.rb +1 -0
  17. data/lib/telegram/bot/types/chat_member_restricted.rb +2 -0
  18. data/lib/telegram/bot/types/chat_owner_changed.rb +11 -0
  19. data/lib/telegram/bot/types/chat_owner_left.rb +11 -0
  20. data/lib/telegram/bot/types/chat_permissions.rb +1 -0
  21. data/lib/telegram/bot/types/checklist_task.rb +1 -0
  22. data/lib/telegram/bot/types/forum_topic.rb +1 -0
  23. data/lib/telegram/bot/types/forum_topic_created.rb +1 -0
  24. data/lib/telegram/bot/types/gift.rb +6 -0
  25. data/lib/telegram/bot/types/gift_background.rb +13 -0
  26. data/lib/telegram/bot/types/gift_info.rb +2 -0
  27. data/lib/telegram/bot/types/inline_keyboard_button.rb +2 -0
  28. data/lib/telegram/bot/types/keyboard_button.rb +3 -0
  29. data/lib/telegram/bot/types/keyboard_button_request_managed_bot.rb +13 -0
  30. data/lib/telegram/bot/types/managed_bot_created.rb +11 -0
  31. data/lib/telegram/bot/types/managed_bot_updated.rb +12 -0
  32. data/lib/telegram/bot/types/message.rb +11 -1
  33. data/lib/telegram/bot/types/message_entity.rb +2 -0
  34. data/lib/telegram/bot/types/owned_gift_regular.rb +2 -0
  35. data/lib/telegram/bot/types/poll.rb +4 -1
  36. data/lib/telegram/bot/types/poll_answer.rb +1 -0
  37. data/lib/telegram/bot/types/poll_option.rb +4 -0
  38. data/lib/telegram/bot/types/poll_option_added.rb +14 -0
  39. data/lib/telegram/bot/types/poll_option_deleted.rb +14 -0
  40. data/lib/telegram/bot/types/prepared_keyboard_button.rb +11 -0
  41. data/lib/telegram/bot/types/reply_parameters.rb +1 -0
  42. data/lib/telegram/bot/types/unique_gift.rb +5 -0
  43. data/lib/telegram/bot/types/unique_gift_colors.rb +16 -0
  44. data/lib/telegram/bot/types/unique_gift_info.rb +2 -1
  45. data/lib/telegram/bot/types/unique_gift_model.rb +1 -0
  46. data/lib/telegram/bot/types/update.rb +1 -0
  47. data/lib/telegram/bot/types/user.rb +3 -0
  48. data/lib/telegram/bot/types/user_profile_audios.rb +12 -0
  49. data/lib/telegram/bot/types/user_rating.rb +14 -0
  50. data/lib/telegram/bot/types/video.rb +1 -0
  51. data/lib/telegram/bot/types/video_quality.rb +16 -0
  52. data/lib/telegram/bot/version.rb +1 -1
  53. data/mise.toml +2 -0
  54. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83c30ffac80ea5559686756be98a5e98d658e6011b1fce283cb5738a3fdb5e47
4
- data.tar.gz: ec475ab5058610092287d0c92dad8547ab848b933aeee1d41068e0384cebf5a9
3
+ metadata.gz: 147ce110bf7814bf274a349a690e50c3c765d21465de7a705e828751f8467f23
4
+ data.tar.gz: beaf1f9e171e3da2e57ec678a39732a715938542401369ab879d3ee4f6c0c310
5
5
  SHA512:
6
- metadata.gz: 190793765c8bd99d382b20d81878234fc63885c55f1a4666a79e50bb6c9ed720ea4a964690c8230b63bcbb723b84e6462263ec0a75b67a681ebde062b1200efe
7
- data.tar.gz: 3f1c1874c4a888590f9c6f8370486bc7097dadf9264795c71f1a5f8ca0afb62a8152eb0f4778c6ccb8bdf6a1d6f66f0f0304a8eec3f8b18fc5d8eb1eea5187a3
6
+ metadata.gz: c877eedeec06700c6691d569ba6ec01891274b661e6a3d40455c16492ef3486c26b3abe3c44de1857fb444c64aad651d792c6de1f2dda3c3299c77b11cd64955
7
+ data.tar.gz: cccdc34911f698b2069d6e0a6221d2e80cbecc5df947b19b7f204670bdfd59b6e6870dd52b5695a53f2baa916eca3b3719251db7c3812a8521f2512e2b1ee40b
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: update-api
3
+ description: Parse Telegram Bot API docs and rebuild generated Ruby types and endpoints
4
+ disable-model-invocation: true
5
+ allowed-tools: Bash, Read, Edit, Grep, WebFetch
6
+ ---
7
+
8
+ Update generated types and API endpoints from the latest Telegram Bot API documentation.
9
+
10
+ ## Step 1: Check for updates
11
+
12
+ 1. Fetch <https://core.telegram.org/bots/api-changelog> and identify the most recent Bot API version and all version entries listed.
13
+ 2. Read `CHANGELOG.md` and find the highest Bot API version mentioned to determine which version this lib currently supports.
14
+ 3. List all Bot API versions that are newer than the lib's current version, with a summary of changes for each.
15
+ 4. If the lib is already up to date, stop here and inform the user.
16
+
17
+ ## Step 2: Parse
18
+
19
+ Run both parse tasks to scrape the latest Telegram Bot API docs:
20
+
21
+ ```
22
+ bundle exec rake parse:types
23
+ bundle exec rake parse:methods
24
+ ```
25
+
26
+ ## Step 3: Rebuild
27
+
28
+ Before rebuilding, read the custom method files listed in Step 4 so you have a snapshot of their current content.
29
+
30
+ Regenerate Ruby source files from the parsed JSON data:
31
+
32
+ ```
33
+ bundle exec rake rebuild:types
34
+ bundle exec rake rebuild:methods
35
+ ```
36
+
37
+ ## Step 4: Restore custom methods
38
+
39
+ The rebuild overwrites type files from templates, losing hand-written methods. After rebuild, read each file below and restore the custom method if it's missing:
40
+
41
+ | File | Method to restore |
42
+ |---|---|
43
+ | `lib/telegram/bot/types/callback_query.rb` | `def to_s` returning `data.to_s` |
44
+ | `lib/telegram/bot/types/message.rb` | `def to_s` returning `text.to_s` |
45
+ | `lib/telegram/bot/types/chosen_inline_result.rb` | `alias to_s query` |
46
+ | `lib/telegram/bot/types/inline_query.rb` | `alias to_s query` |
47
+ | `lib/telegram/bot/types/inline_keyboard_markup.rb` | `def to_compact_hash` that calls `to_compact_hash` on nested `InlineKeyboardButton` items |
48
+ | `lib/telegram/bot/types/reply_keyboard_markup.rb` | `def to_compact_hash` that calls `to_compact_hash` on nested `KeyboardButton` items |
49
+ | `lib/telegram/bot/types/update.rb` | `def current_message` that finds the first non-`update_id` attribute value |
50
+
51
+ For each file:
52
+
53
+ 1. Read the current file content
54
+ 2. Check if the custom method/alias is already present
55
+ 3. If missing, add it back before the closing `end` of the class, with one blank line before it
56
+
57
+ ## Step 5: Review changes
58
+
59
+ Run `git diff --stat` and then `git diff` to review all changes. Summarize what was added/modified/removed compared to the previous version.
60
+
61
+ ## Step 6: Lint and test
62
+
63
+ Run linting and tests to verify everything is correct:
64
+
65
+ ```
66
+ bundle exec rubocop
67
+ bundle exec rake spec
68
+ ```
69
+
70
+ If rubocop or tests fail, fix the issues before finishing.
@@ -13,7 +13,8 @@ jobs:
13
13
  matrix:
14
14
  ruby:
15
15
  - 2.7
16
- - 3.2
16
+ - 3.4
17
+ - 4.0
17
18
  steps:
18
19
  - name: Checkout
19
20
  uses: actions/checkout@v3
@@ -31,7 +32,8 @@ jobs:
31
32
  matrix:
32
33
  ruby:
33
34
  - 2.7
34
- - 3.2
35
+ - 3.4
36
+ - 4.0
35
37
  steps:
36
38
  - name: Checkout
37
39
  uses: actions/checkout@v3
data/.gitignore CHANGED
@@ -2,6 +2,7 @@ Gemfile.lock
2
2
 
3
3
  .bundle/
4
4
  .env
5
+ /.claude/*.local.json
5
6
  pkg/
6
7
  tmp/
7
8
  vendor/bundle/
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Added
6
+
7
+ - [Bot API 9.6](https://core.telegram.org/bots/api-changelog#april-3-2026) [#335](https://github.com/atipugin/telegram-bot-ruby/pull/335)
8
+
9
+ ## 2.6.0
10
+
11
+ ### Added
12
+
13
+ - [Bot API 9.4](https://core.telegram.org/bots/api-changelog#february-9-2026) + [Bot API 9.5](https://core.telegram.org/bots/api-changelog#march-1-2026) [#334](https://github.com/atipugin/telegram-bot-ruby/pull/334)
14
+ - Support for configuring Faraday adapter options [#333](https://github.com/atipugin/telegram-bot-ruby/pull/333) (thx [@dmeremyanin](https://github.com/dmeremyanin))
15
+ - [Bot API 9.3](https://core.telegram.org/bots/api-changelog#december-31-2025) [#328](https://github.com/atipugin/telegram-bot-ruby/pull/328)
16
+ - `CallbackQuery#to_s` for improved logging [#327](https://github.com/atipugin/telegram-bot-ruby/pull/327) (thx [@projecteurlumiere](https://github.com/projecteurlumiere))
17
+
3
18
  ## 2.5.0
4
19
 
5
20
  ### Added
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ gem 'pry'
10
10
  gem 'rake', '~> 13.0'
11
11
 
12
12
  gem 'rspec', '~> 3.4'
13
- gem 'vcr', '~> 6.0'
13
+ gem 'vcr', '~> 6.4'
14
14
 
15
15
  gem 'rubocop', '~> 1.66.1'
16
16
  gem 'rubocop-performance', '~> 1.18'
data/README.md CHANGED
@@ -7,29 +7,12 @@ Ruby wrapper for [Telegram's Bot API](https://core.telegram.org/bots/api).
7
7
  [![Maintainability](https://api.codeclimate.com/v1/badges/7e61fbf5bec86e118fb1/maintainability)](https://codeclimate.com/github/atipugin/telegram-bot-ruby/maintainability)
8
8
  [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks!-🦉-1EAEDB.svg)](https://saythanks.io/to/atipugin)
9
9
 
10
- ## 🚧 Upgrading to 1.0
11
-
12
- Since v1.0 `telegram-bot-ruby` uses [`dry-struct`](https://github.com/dry-rb/dry-struct)
13
- instead of [`virtus`](https://github.com/solnic/virtus).
14
- This means that type objects are now immutable and you can't change them after initialization:
15
-
16
- ```ruby
17
- # This won't work
18
- kb = Telegram::Bot::Types::ReplyKeyboardRemove.new
19
- kb.remove_keyboard = true
20
-
21
- # You have to set attributes in constructor instead
22
- kb = Telegram::Bot::Types::ReplyKeyboardRemove.new(remove_keyboard: true)
23
- ```
24
-
25
- Please make sure it doesn't break your existing code before upgrading to 1.0.
26
-
27
10
  ## Installation
28
11
 
29
12
  Add following line to your Gemfile:
30
13
 
31
14
  ```ruby
32
- gem 'telegram-bot-ruby', '~> 2.1'
15
+ gem 'telegram-bot-ruby', '~> 2.5'
33
16
  ```
34
17
 
35
18
  And then execute:
@@ -115,6 +98,16 @@ Telegram::Bot::Client.run(token, url: 'https://proxy.example.com') do |bot|
115
98
  end
116
99
  ```
117
100
 
101
+ If you want to use a SOCKS5 proxy with the [Excon](https://github.com/excon/excon) adapter,
102
+ you can configure it like this:
103
+
104
+ ```ruby
105
+ Telegram::Bot.configure do |config|
106
+ config.adapter = :excon
107
+ config.adapter_options = { socks5_proxy: 'socks5://socks.proxy:1080' }
108
+ end
109
+ ```
110
+
118
111
  ## Custom keyboards
119
112
 
120
113
  You can use your own [custom keyboards](https://core.telegram.org/bots#keyboards).
@@ -239,7 +232,7 @@ end
239
232
 
240
233
  ## Logging
241
234
 
242
- By default, bot doesn't log anything (uses `NullLoger`).
235
+ By default, bot doesn't log anything (uses `NullLogger`).
243
236
  You can change this behavior and provide your own logger class.
244
237
  See example below:
245
238
 
@@ -265,12 +258,36 @@ Telegram::Bot.configure do |config|
265
258
  end
266
259
  ```
267
260
 
268
- ## Boilerplates
261
+ If your adapter supports additional configuration, you can pass options as a hash:
262
+
263
+ ```ruby
264
+ Telegram::Bot.configure do |config|
265
+ config.adapter = :httpx
266
+ config.adapter_options = { persistent: false }
267
+ end
268
+ ```
269
+
270
+ ## Maintenance
271
+
272
+ This gem provides rake tasks to parse the official [Telegram Bot API documentation](https://core.telegram.org/bots/api) and regenerate types and API methods.
273
+
274
+ ### Parsing
275
+
276
+ Parse types and methods from the official documentation:
277
+
278
+ ```shell
279
+ rake parse:types # Parses types to data/types.json
280
+ rake parse:methods # Parses methods to data/methods.json
281
+ ```
282
+
283
+ ### Rebuilding
269
284
 
270
- If you don't know how to setup database for your bot or how to use it with different languages
271
- here are some boilerplates which can help you to start faster:
285
+ Regenerate Ruby code from the parsed JSON data:
272
286
 
273
- - [Ruby Telegram Bot boilerplate](https://github.com/telegram-bots/ruby-telegram-bot-boilerplate)
287
+ ```shell
288
+ rake rebuild:types # Rebuilds lib/telegram/bot/types/*.rb
289
+ rake rebuild:methods # Rebuilds lib/telegram/bot/api/endpoints.rb
290
+ ```
274
291
 
275
292
  ## Contributing
276
293
 
@@ -31,9 +31,11 @@ module Telegram
31
31
  'sendPoll' => Types::Message,
32
32
  'sendChecklist' => Types::Message,
33
33
  'sendDice' => Types::Message,
34
+ 'sendMessageDraft' => Types::Bool,
34
35
  'sendChatAction' => Types::Bool,
35
36
  'setMessageReaction' => Types::Bool,
36
37
  'getUserProfilePhotos' => Types::UserProfilePhotos,
38
+ 'getUserProfileAudios' => Types::UserProfileAudios,
37
39
  'setUserEmojiStatus' => Types::Bool,
38
40
  'getFile' => Types::File,
39
41
  'banChatMember' => Types::Bool,
@@ -41,6 +43,7 @@ module Telegram
41
43
  'restrictChatMember' => Types::Bool,
42
44
  'promoteChatMember' => Types::Bool,
43
45
  'setChatAdministratorCustomTitle' => Types::Bool,
46
+ 'setChatMemberTag' => Types::Bool,
44
47
  'banChatSenderChat' => Types::Bool,
45
48
  'unbanChatSenderChat' => Types::Bool,
46
49
  'setChatPermissions' => Types::Bool,
@@ -82,6 +85,8 @@ module Telegram
82
85
  'answerCallbackQuery' => Types::Bool,
83
86
  'getUserChatBoosts' => Types::UserChatBoosts,
84
87
  'getBusinessConnection' => Types::BusinessConnection,
88
+ 'getManagedBotToken' => Types::String,
89
+ 'replaceManagedBotToken' => Types::String,
85
90
  'setMyCommands' => Types::Bool,
86
91
  'deleteMyCommands' => Types::Bool,
87
92
  'getMyCommands' => Types::Array.of(Types::BotCommand),
@@ -91,6 +96,8 @@ module Telegram
91
96
  'getMyDescription' => Types::BotDescription,
92
97
  'setMyShortDescription' => Types::Bool,
93
98
  'getMyShortDescription' => Types::BotShortDescription,
99
+ 'setMyProfilePhoto' => Types::Bool,
100
+ 'removeMyProfilePhoto' => Types::Bool,
94
101
  'setChatMenuButton' => Types::Bool,
95
102
  'getChatMenuButton' => Types::MenuButton,
96
103
  'setMyDefaultAdministratorRights' => Types::Bool,
@@ -113,12 +120,18 @@ module Telegram
113
120
  'getBusinessAccountStarBalance' => Types::StarAmount,
114
121
  'transferBusinessAccountStars' => Types::Bool,
115
122
  'getBusinessAccountGifts' => Types::OwnedGifts,
123
+ 'getUserGifts' => Types::OwnedGifts,
124
+ 'getChatGifts' => Types::OwnedGifts,
116
125
  'convertGiftToStars' => Types::Bool,
117
126
  'upgradeGift' => Types::Bool,
118
127
  'transferGift' => Types::Bool,
119
128
  'postStory' => Types::Story,
129
+ 'repostStory' => Types::Story,
120
130
  'editStory' => Types::Story,
121
131
  'deleteStory' => Types::Bool,
132
+ 'answerWebAppQuery' => Types::SentWebAppMessage,
133
+ 'savePreparedInlineMessage' => Types::PreparedInlineMessage,
134
+ 'savePreparedKeyboardButton' => Types::PreparedKeyboardButton,
122
135
  'editMessageText' => Types::Message | Types::Bool,
123
136
  'editMessageCaption' => Types::Message | Types::Bool,
124
137
  'editMessageMedia' => Types::Message | Types::Bool,
@@ -148,8 +161,6 @@ module Telegram
148
161
  'setCustomEmojiStickerSetThumbnail' => Types::Bool,
149
162
  'deleteStickerSet' => Types::Bool,
150
163
  'answerInlineQuery' => Types::Bool,
151
- 'answerWebAppQuery' => Types::SentWebAppMessage,
152
- 'savePreparedInlineMessage' => Types::PreparedInlineMessage,
153
164
  'sendInvoice' => Types::Message,
154
165
  'createInvoiceLink' => Types::String,
155
166
  'answerShippingQuery' => Types::Bool,
@@ -15,7 +15,7 @@ module Telegram
15
15
  @connection ||= Faraday.new(url: url) do |faraday|
16
16
  faraday.request :multipart
17
17
  faraday.request :url_encoded
18
- faraday.adapter Telegram::Bot.configuration.adapter
18
+ configure_adapter(faraday)
19
19
  faraday.options.timeout = Telegram::Bot.configuration.connection_timeout
20
20
  faraday.options.open_timeout = Telegram::Bot.configuration.connection_open_timeout
21
21
  end
@@ -52,6 +52,18 @@ module Telegram
52
52
 
53
53
  private
54
54
 
55
+ def configure_adapter(faraday)
56
+ if adapter_options.empty?
57
+ faraday.adapter Telegram::Bot.configuration.adapter
58
+ else
59
+ faraday.adapter Telegram::Bot.configuration.adapter, **adapter_options
60
+ end
61
+ end
62
+
63
+ def adapter_options
64
+ Telegram::Bot.configuration.adapter_options || {}
65
+ end
66
+
55
67
  def build_params(params)
56
68
  params.transform_values do |value|
57
69
  sanitize_value(value)
@@ -3,10 +3,11 @@
3
3
  module Telegram
4
4
  module Bot
5
5
  class Configuration
6
- attr_accessor :adapter, :connection_open_timeout, :connection_timeout
6
+ attr_accessor :adapter, :adapter_options, :connection_open_timeout, :connection_timeout
7
7
 
8
8
  def initialize
9
9
  @adapter = Faraday.default_adapter
10
+ @adapter_options = nil
10
11
  @connection_open_timeout = 20
11
12
  @connection_timeout = 20
12
13
  end
@@ -8,6 +8,7 @@ module Telegram
8
8
  attribute :limited_gifts, Types::Bool
9
9
  attribute :unique_gifts, Types::Bool
10
10
  attribute :premium_subscription, Types::Bool
11
+ attribute :gifts_from_channels, Types::Bool
11
12
  end
12
13
  end
13
14
  end
@@ -11,6 +11,10 @@ module Telegram
11
11
  attribute :chat_instance, Types::String
12
12
  attribute? :data, Types::String
13
13
  attribute? :game_short_name, Types::String
14
+
15
+ def to_s
16
+ data.to_s
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -20,6 +20,7 @@ module Telegram
20
20
  attribute? :can_pin_messages, Types::Bool
21
21
  attribute? :can_manage_topics, Types::Bool
22
22
  attribute? :can_manage_direct_messages, Types::Bool
23
+ attribute? :can_manage_tags, Types::Bool
23
24
  end
24
25
  end
25
26
  end
@@ -51,6 +51,10 @@ module Telegram
51
51
  attribute? :custom_emoji_sticker_set_name, Types::String
52
52
  attribute? :linked_chat_id, Types::Integer
53
53
  attribute? :location, ChatLocation
54
+ attribute? :rating, UserRating
55
+ attribute? :first_profile_audio, Audio
56
+ attribute? :unique_gift_colors, UniqueGiftColors
57
+ attribute? :paid_message_star_count, Types::Integer
54
58
  end
55
59
  end
56
60
  end
@@ -23,6 +23,7 @@ module Telegram
23
23
  attribute? :can_pin_messages, Types::Bool
24
24
  attribute? :can_manage_topics, Types::Bool
25
25
  attribute? :can_manage_direct_messages, Types::Bool
26
+ attribute? :can_manage_tags, Types::Bool
26
27
  attribute? :custom_title, Types::String
27
28
  end
28
29
  end
@@ -5,6 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class ChatMemberMember < Base
7
7
  attribute :status, Types::String.constrained(eql: 'member').default('member')
8
+ attribute? :tag, Types::String
8
9
  attribute :user, User
9
10
  attribute? :until_date, Types::Integer
10
11
  end
@@ -5,6 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class ChatMemberRestricted < Base
7
7
  attribute :status, Types::String.constrained(eql: 'restricted').default('restricted')
8
+ attribute? :tag, Types::String
8
9
  attribute :user, User
9
10
  attribute :is_member, Types::Bool
10
11
  attribute :can_send_messages, Types::Bool
@@ -17,6 +18,7 @@ module Telegram
17
18
  attribute :can_send_polls, Types::Bool
18
19
  attribute :can_send_other_messages, Types::Bool
19
20
  attribute :can_add_web_page_previews, Types::Bool
21
+ attribute :can_edit_tag, Types::Bool
20
22
  attribute :can_change_info, Types::Bool
21
23
  attribute :can_invite_users, Types::Bool
22
24
  attribute :can_pin_messages, Types::Bool
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ChatOwnerChanged < Base
7
+ attribute :new_owner, User
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 ChatOwnerLeft < Base
7
+ attribute? :new_owner, User
8
+ end
9
+ end
10
+ end
11
+ end
@@ -14,6 +14,7 @@ module Telegram
14
14
  attribute? :can_send_polls, Types::Bool
15
15
  attribute? :can_send_other_messages, Types::Bool
16
16
  attribute? :can_add_web_page_previews, Types::Bool
17
+ attribute? :can_edit_tag, Types::Bool
17
18
  attribute? :can_change_info, Types::Bool
18
19
  attribute? :can_invite_users, Types::Bool
19
20
  attribute? :can_pin_messages, Types::Bool
@@ -8,6 +8,7 @@ module Telegram
8
8
  attribute :text, Types::String
9
9
  attribute? :text_entities, Types::Array.of(MessageEntity)
10
10
  attribute? :completed_by_user, User
11
+ attribute? :completed_by_chat, Chat
11
12
  attribute? :completion_date, Types::Integer
12
13
  end
13
14
  end
@@ -8,6 +8,7 @@ module Telegram
8
8
  attribute :name, Types::String
9
9
  attribute :icon_color, Types::Integer
10
10
  attribute? :icon_custom_emoji_id, Types::String
11
+ attribute? :is_name_implicit, Types::True
11
12
  end
12
13
  end
13
14
  end
@@ -7,6 +7,7 @@ module Telegram
7
7
  attribute :name, Types::String
8
8
  attribute :icon_color, Types::Integer
9
9
  attribute? :icon_custom_emoji_id, Types::String
10
+ attribute? :is_name_implicit, Types::True
10
11
  end
11
12
  end
12
13
  end
@@ -8,8 +8,14 @@ module Telegram
8
8
  attribute :sticker, Sticker
9
9
  attribute :star_count, Types::Integer
10
10
  attribute? :upgrade_star_count, Types::Integer
11
+ attribute? :is_premium, Types::True
12
+ attribute? :has_colors, Types::True
11
13
  attribute? :total_count, Types::Integer
12
14
  attribute? :remaining_count, Types::Integer
15
+ attribute? :personal_total_count, Types::Integer
16
+ attribute? :personal_remaining_count, Types::Integer
17
+ attribute? :background, GiftBackground
18
+ attribute? :unique_gift_variant_count, Types::Integer
13
19
  attribute? :publisher_chat, Chat
14
20
  end
15
21
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class GiftBackground < Base
7
+ attribute :center_color, Types::Integer
8
+ attribute :edge_color, Types::Integer
9
+ attribute :text_color, Types::Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -8,10 +8,12 @@ module Telegram
8
8
  attribute? :owned_gift_id, Types::String
9
9
  attribute? :convert_star_count, Types::Integer
10
10
  attribute? :prepaid_upgrade_star_count, Types::Integer
11
+ attribute? :is_upgrade_separate, Types::True
11
12
  attribute? :can_be_upgraded, Types::True
12
13
  attribute? :text, Types::String
13
14
  attribute? :entities, Types::Array.of(MessageEntity)
14
15
  attribute? :is_private, Types::True
16
+ attribute? :unique_gift_number, Types::Integer
15
17
  end
16
18
  end
17
19
  end
@@ -5,6 +5,8 @@ module Telegram
5
5
  module Types
6
6
  class InlineKeyboardButton < Base
7
7
  attribute :text, Types::String
8
+ attribute? :icon_custom_emoji_id, Types::String
9
+ attribute? :style, Types::String
8
10
  attribute? :url, Types::String
9
11
  attribute? :callback_data, Types::String
10
12
  attribute? :web_app, WebAppInfo
@@ -5,8 +5,11 @@ module Telegram
5
5
  module Types
6
6
  class KeyboardButton < Base
7
7
  attribute :text, Types::String
8
+ attribute? :icon_custom_emoji_id, Types::String
9
+ attribute? :style, Types::String
8
10
  attribute? :request_users, KeyboardButtonRequestUsers
9
11
  attribute? :request_chat, KeyboardButtonRequestChat
12
+ attribute? :request_managed_bot, KeyboardButtonRequestManagedBot
10
13
  attribute? :request_contact, Types::Bool
11
14
  attribute? :request_location, Types::Bool
12
15
  attribute? :request_poll, KeyboardButtonPollType
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class KeyboardButtonRequestManagedBot < Base
7
+ attribute :request_id, Types::Integer
8
+ attribute? :suggested_name, Types::String
9
+ attribute? :suggested_username, Types::String
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 ManagedBotCreated < Base
7
+ attribute :bot, User
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 ManagedBotUpdated < Base
7
+ attribute :user, User
8
+ attribute :bot, User
9
+ end
10
+ end
11
+ end
12
+ end
@@ -11,6 +11,7 @@ module Telegram
11
11
  attribute? :sender_chat, Chat
12
12
  attribute? :sender_boost_count, Types::Integer
13
13
  attribute? :sender_business_bot, User
14
+ attribute? :sender_tag, Types::String
14
15
  attribute :date, Types::Integer
15
16
  attribute? :business_connection_id, Types::String
16
17
  attribute :chat, Chat
@@ -22,6 +23,7 @@ module Telegram
22
23
  attribute? :quote, TextQuote
23
24
  attribute? :reply_to_story, Story
24
25
  attribute? :reply_to_checklist_task_id, Types::Integer
26
+ attribute? :reply_to_poll_option_id, Types::String
25
27
  attribute? :via_bot, User
26
28
  attribute? :edit_date, Types::Integer
27
29
  attribute? :has_protected_content, Types::True
@@ -58,6 +60,8 @@ module Telegram
58
60
  attribute? :location, Location
59
61
  attribute? :new_chat_members, Types::Array.of(User)
60
62
  attribute? :left_chat_member, User
63
+ attribute? :chat_owner_left, ChatOwnerLeft
64
+ attribute? :chat_owner_changed, ChatOwnerChanged
61
65
  attribute? :new_chat_title, Types::String
62
66
  attribute? :new_chat_photo, Types::Array.of(PhotoSize)
63
67
  attribute? :delete_chat_photo, Types::True
@@ -75,6 +79,7 @@ module Telegram
75
79
  attribute? :chat_shared, ChatShared
76
80
  attribute? :gift, GiftInfo
77
81
  attribute? :unique_gift, UniqueGiftInfo
82
+ attribute? :gift_upgrade_sent, GiftInfo
78
83
  attribute? :connected_website, Types::String
79
84
  attribute? :write_access_allowed, WriteAccessAllowed
80
85
  attribute? :passport_data, PassportData
@@ -94,7 +99,10 @@ module Telegram
94
99
  attribute? :giveaway, Giveaway
95
100
  attribute? :giveaway_winners, GiveawayWinners
96
101
  attribute? :giveaway_completed, GiveawayCompleted
102
+ attribute? :managed_bot_created, ManagedBotCreated
97
103
  attribute? :paid_message_price_changed, PaidMessagePriceChanged
104
+ attribute? :poll_option_added, PollOptionAdded
105
+ attribute? :poll_option_deleted, PollOptionDeleted
98
106
  attribute? :suggested_post_approved, SuggestedPostApproved
99
107
  attribute? :suggested_post_approval_failed, SuggestedPostApprovalFailed
100
108
  attribute? :suggested_post_declined, SuggestedPostDeclined
@@ -107,7 +115,9 @@ module Telegram
107
115
  attribute? :web_app_data, WebAppData
108
116
  attribute? :reply_markup, InlineKeyboardMarkup
109
117
 
110
- alias to_s text
118
+ def to_s
119
+ text.to_s
120
+ end
111
121
  end
112
122
  end
113
123
  end
@@ -11,6 +11,8 @@ module Telegram
11
11
  attribute? :user, User
12
12
  attribute? :language, Types::String
13
13
  attribute? :custom_emoji_id, Types::String
14
+ attribute? :unix_time, Types::Integer
15
+ attribute? :date_time_format, Types::String
14
16
  end
15
17
  end
16
18
  end
@@ -17,6 +17,8 @@ module Telegram
17
17
  attribute? :was_refunded, Types::True
18
18
  attribute? :convert_star_count, Types::Integer
19
19
  attribute? :prepaid_upgrade_star_count, Types::Integer
20
+ attribute? :is_upgrade_separate, Types::True
21
+ attribute? :unique_gift_number, Types::Integer
20
22
  end
21
23
  end
22
24
  end
@@ -13,11 +13,14 @@ module Telegram
13
13
  attribute :is_anonymous, Types::Bool
14
14
  attribute :type, Types::String
15
15
  attribute :allows_multiple_answers, Types::Bool
16
- attribute? :correct_option_id, Types::Integer
16
+ attribute :allows_revoting, Types::Bool
17
+ attribute? :correct_option_ids, Types::Array.of(Types::Integer)
17
18
  attribute? :explanation, Types::String
18
19
  attribute? :explanation_entities, Types::Array.of(MessageEntity)
19
20
  attribute? :open_period, Types::Integer
20
21
  attribute? :close_date, Types::Integer
22
+ attribute? :description, Types::String
23
+ attribute? :description_entities, Types::Array.of(MessageEntity)
21
24
  end
22
25
  end
23
26
  end
@@ -8,6 +8,7 @@ module Telegram
8
8
  attribute? :voter_chat, Chat
9
9
  attribute? :user, User
10
10
  attribute :option_ids, Types::Array.of(Types::Integer)
11
+ attribute :option_persistent_ids, Types::Array.of(Types::String)
11
12
  end
12
13
  end
13
14
  end
@@ -4,9 +4,13 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PollOption < Base
7
+ attribute :persistent_id, Types::String
7
8
  attribute :text, Types::String.constrained(min_size: 1, max_size: 100)
8
9
  attribute? :text_entities, Types::Array.of(MessageEntity)
9
10
  attribute :voter_count, Types::Integer
11
+ attribute? :added_by_user, User
12
+ attribute? :added_by_chat, Chat
13
+ attribute? :addition_date, Types::Integer
10
14
  end
11
15
  end
12
16
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class PollOptionAdded < Base
7
+ attribute? :poll_message, MaybeInaccessibleMessage
8
+ attribute :option_persistent_id, Types::String
9
+ attribute :option_text, Types::String
10
+ attribute? :option_text_entities, Types::Array.of(MessageEntity)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class PollOptionDeleted < Base
7
+ attribute? :poll_message, MaybeInaccessibleMessage
8
+ attribute :option_persistent_id, Types::String
9
+ attribute :option_text, Types::String
10
+ attribute? :option_text_entities, Types::Array.of(MessageEntity)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class PreparedKeyboardButton < Base
7
+ attribute :id, Types::String
8
+ end
9
+ end
10
+ end
11
+ end
@@ -12,6 +12,7 @@ module Telegram
12
12
  attribute? :quote_entities, Types::Array.of(MessageEntity)
13
13
  attribute? :quote_position, Types::Integer
14
14
  attribute? :checklist_task_id, Types::Integer
15
+ attribute? :poll_option_id, Types::String
15
16
  end
16
17
  end
17
18
  end
@@ -4,12 +4,17 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class UniqueGift < Base
7
+ attribute :gift_id, Types::String
7
8
  attribute :base_name, Types::String
8
9
  attribute :name, Types::String
9
10
  attribute :number, Types::Integer
10
11
  attribute :model, UniqueGiftModel
11
12
  attribute :symbol, UniqueGiftSymbol
12
13
  attribute :backdrop, UniqueGiftBackdrop
14
+ attribute? :is_premium, Types::True
15
+ attribute? :is_burned, Types::True
16
+ attribute? :is_from_blockchain, Types::True
17
+ attribute? :colors, UniqueGiftColors
13
18
  attribute? :publisher_chat, Chat
14
19
  end
15
20
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class UniqueGiftColors < Base
7
+ attribute :model_custom_emoji_id, Types::String
8
+ attribute :symbol_custom_emoji_id, Types::String
9
+ attribute :light_theme_main_color, Types::Integer
10
+ attribute :light_theme_other_colors, Types::Array.of(Types::Integer)
11
+ attribute :dark_theme_main_color, Types::Integer
12
+ attribute :dark_theme_other_colors, Types::Array.of(Types::Integer)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -6,7 +6,8 @@ module Telegram
6
6
  class UniqueGiftInfo < Base
7
7
  attribute :gift, UniqueGift
8
8
  attribute :origin, Types::String
9
- attribute? :last_resale_star_count, Types::Integer
9
+ attribute? :last_resale_currency, Types::String
10
+ attribute? :last_resale_amount, Types::Integer
10
11
  attribute? :owned_gift_id, Types::String
11
12
  attribute? :transfer_star_count, Types::Integer
12
13
  attribute? :next_transfer_date, Types::Integer
@@ -7,6 +7,7 @@ module Telegram
7
7
  attribute :name, Types::String
8
8
  attribute :sticker, Sticker
9
9
  attribute :rarity_per_mille, Types::Integer
10
+ attribute? :rarity, Types::String
10
11
  end
11
12
  end
12
13
  end
@@ -28,6 +28,7 @@ module Telegram
28
28
  attribute? :chat_join_request, ChatJoinRequest
29
29
  attribute? :chat_boost, ChatBoostUpdated
30
30
  attribute? :removed_chat_boost, ChatBoostRemoved
31
+ attribute? :managed_bot, ManagedBotUpdated
31
32
 
32
33
  def current_message
33
34
  @current_message ||=
@@ -17,6 +17,9 @@ module Telegram
17
17
  attribute? :supports_inline_queries, Types::Bool
18
18
  attribute? :can_connect_to_business, Types::Bool
19
19
  attribute? :has_main_web_app, Types::Bool
20
+ attribute? :has_topics_enabled, Types::Bool
21
+ attribute? :allows_users_to_create_topics, Types::Bool
22
+ attribute? :can_manage_bots, Types::Bool
20
23
  end
21
24
  end
22
25
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class UserProfileAudios < Base
7
+ attribute :total_count, Types::Integer
8
+ attribute :audios, Types::Array.of(Audio)
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 UserRating < Base
7
+ attribute :level, Types::Integer
8
+ attribute :rating, Types::Integer
9
+ attribute :current_level_rating, Types::Integer
10
+ attribute? :next_level_rating, Types::Integer
11
+ end
12
+ end
13
+ end
14
+ end
@@ -12,6 +12,7 @@ module Telegram
12
12
  attribute? :thumbnail, PhotoSize
13
13
  attribute? :cover, Types::Array.of(PhotoSize)
14
14
  attribute? :start_timestamp, Types::Integer
15
+ attribute? :qualities, Types::Array.of(VideoQuality)
15
16
  attribute? :file_name, Types::String
16
17
  attribute? :mime_type, Types::String
17
18
  attribute? :file_size, Types::Integer
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class VideoQuality < Base
7
+ attribute :file_id, Types::String
8
+ attribute :file_unique_id, Types::String
9
+ attribute :width, Types::Integer
10
+ attribute :height, Types::Integer
11
+ attribute :codec, Types::String
12
+ attribute? :file_size, Types::Integer
13
+ end
14
+ end
15
+ end
16
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Telegram
4
4
  module Bot
5
- VERSION = '2.5.0'
5
+ VERSION = '2.7.0'
6
6
  end
7
7
  end
data/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ ruby = "4"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram-bot-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tipugin
@@ -71,6 +71,7 @@ executables: []
71
71
  extensions: []
72
72
  extra_rdoc_files: []
73
73
  files:
74
+ - ".claude/skills/update-api/SKILL.md"
74
75
  - ".editorconfig"
75
76
  - ".env.sample"
76
77
  - ".github/workflows/ci.yml"
@@ -154,6 +155,8 @@ files:
154
155
  - lib/telegram/bot/types/chat_member_owner.rb
155
156
  - lib/telegram/bot/types/chat_member_restricted.rb
156
157
  - lib/telegram/bot/types/chat_member_updated.rb
158
+ - lib/telegram/bot/types/chat_owner_changed.rb
159
+ - lib/telegram/bot/types/chat_owner_left.rb
157
160
  - lib/telegram/bot/types/chat_permissions.rb
158
161
  - lib/telegram/bot/types/chat_photo.rb
159
162
  - lib/telegram/bot/types/chat_shared.rb
@@ -185,6 +188,7 @@ files:
185
188
  - lib/telegram/bot/types/general_forum_topic_hidden.rb
186
189
  - lib/telegram/bot/types/general_forum_topic_unhidden.rb
187
190
  - lib/telegram/bot/types/gift.rb
191
+ - lib/telegram/bot/types/gift_background.rb
188
192
  - lib/telegram/bot/types/gift_info.rb
189
193
  - lib/telegram/bot/types/gifts.rb
190
194
  - lib/telegram/bot/types/giveaway.rb
@@ -247,12 +251,15 @@ files:
247
251
  - lib/telegram/bot/types/keyboard_button.rb
248
252
  - lib/telegram/bot/types/keyboard_button_poll_type.rb
249
253
  - lib/telegram/bot/types/keyboard_button_request_chat.rb
254
+ - lib/telegram/bot/types/keyboard_button_request_managed_bot.rb
250
255
  - lib/telegram/bot/types/keyboard_button_request_users.rb
251
256
  - lib/telegram/bot/types/labeled_price.rb
252
257
  - lib/telegram/bot/types/link_preview_options.rb
253
258
  - lib/telegram/bot/types/location.rb
254
259
  - lib/telegram/bot/types/location_address.rb
255
260
  - lib/telegram/bot/types/login_url.rb
261
+ - lib/telegram/bot/types/managed_bot_created.rb
262
+ - lib/telegram/bot/types/managed_bot_updated.rb
256
263
  - lib/telegram/bot/types/mask_position.rb
257
264
  - lib/telegram/bot/types/maybe_inaccessible_message.rb
258
265
  - lib/telegram/bot/types/menu_button.rb
@@ -299,8 +306,11 @@ files:
299
306
  - lib/telegram/bot/types/poll.rb
300
307
  - lib/telegram/bot/types/poll_answer.rb
301
308
  - lib/telegram/bot/types/poll_option.rb
309
+ - lib/telegram/bot/types/poll_option_added.rb
310
+ - lib/telegram/bot/types/poll_option_deleted.rb
302
311
  - lib/telegram/bot/types/pre_checkout_query.rb
303
312
  - lib/telegram/bot/types/prepared_inline_message.rb
313
+ - lib/telegram/bot/types/prepared_keyboard_button.rb
304
314
  - lib/telegram/bot/types/proximity_alert_triggered.rb
305
315
  - lib/telegram/bot/types/reaction_count.rb
306
316
  - lib/telegram/bot/types/reaction_type.rb
@@ -357,13 +367,16 @@ files:
357
367
  - lib/telegram/bot/types/unique_gift.rb
358
368
  - lib/telegram/bot/types/unique_gift_backdrop.rb
359
369
  - lib/telegram/bot/types/unique_gift_backdrop_colors.rb
370
+ - lib/telegram/bot/types/unique_gift_colors.rb
360
371
  - lib/telegram/bot/types/unique_gift_info.rb
361
372
  - lib/telegram/bot/types/unique_gift_model.rb
362
373
  - lib/telegram/bot/types/unique_gift_symbol.rb
363
374
  - lib/telegram/bot/types/update.rb
364
375
  - lib/telegram/bot/types/user.rb
365
376
  - lib/telegram/bot/types/user_chat_boosts.rb
377
+ - lib/telegram/bot/types/user_profile_audios.rb
366
378
  - lib/telegram/bot/types/user_profile_photos.rb
379
+ - lib/telegram/bot/types/user_rating.rb
367
380
  - lib/telegram/bot/types/users_shared.rb
368
381
  - lib/telegram/bot/types/venue.rb
369
382
  - lib/telegram/bot/types/video.rb
@@ -372,12 +385,14 @@ files:
372
385
  - lib/telegram/bot/types/video_chat_scheduled.rb
373
386
  - lib/telegram/bot/types/video_chat_started.rb
374
387
  - lib/telegram/bot/types/video_note.rb
388
+ - lib/telegram/bot/types/video_quality.rb
375
389
  - lib/telegram/bot/types/voice.rb
376
390
  - lib/telegram/bot/types/web_app_data.rb
377
391
  - lib/telegram/bot/types/web_app_info.rb
378
392
  - lib/telegram/bot/types/webhook_info.rb
379
393
  - lib/telegram/bot/types/write_access_allowed.rb
380
394
  - lib/telegram/bot/version.rb
395
+ - mise.toml
381
396
  - rakelib/builders/endpoints_builder.rb
382
397
  - rakelib/builders/type_builder.rb
383
398
  - rakelib/parse.rake
@@ -406,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
406
421
  - !ruby/object:Gem::Version
407
422
  version: '0'
408
423
  requirements: []
409
- rubygems_version: 3.6.9
424
+ rubygems_version: 4.0.3
410
425
  specification_version: 4
411
426
  summary: Ruby wrapper for Telegram's Bot API
412
427
  test_files: []