telegram-bot-ruby 2.8.1 → 2.9.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/.agents/skills/commit/SKILL.md +18 -0
  3. data/.agents/skills/update-api/SKILL.md +70 -0
  4. data/.claude/skills +1 -0
  5. data/.rubocop.yml +0 -14
  6. data/CHANGELOG.md +16 -0
  7. data/README.md +16 -2
  8. data/lib/telegram/bot/api/endpoints.rb +9 -0
  9. data/lib/telegram/bot/types/area_position.rb +16 -0
  10. data/lib/telegram/bot/types/chat_administrator_rights.rb +1 -0
  11. data/lib/telegram/bot/types/chat_full_info.rb +2 -0
  12. data/lib/telegram/bot/types/chat_member_administrator.rb +1 -0
  13. data/lib/telegram/bot/types/chat_share_theme.rb +15 -0
  14. data/lib/telegram/bot/types/chat_share_theme_backdrop.rb +13 -0
  15. data/lib/telegram/bot/types/chat_share_theme_backdrops.rb +11 -0
  16. data/lib/telegram/bot/types/chat_share_theme_emoji.rb +13 -0
  17. data/lib/telegram/bot/types/chat_share_theme_unique_gift.rb +12 -0
  18. data/lib/telegram/bot/types/community_chat_joined.rb +11 -0
  19. data/lib/telegram/bot/types/disabled_button.rb +10 -0
  20. data/lib/telegram/bot/types/emoji_type.rb +15 -0
  21. data/lib/telegram/bot/types/emoji_type_custom_emoji.rb +12 -0
  22. data/lib/telegram/bot/types/emoji_type_emoji.rb +12 -0
  23. data/lib/telegram/bot/types/ephemeral_message_parameters.rb +13 -0
  24. data/lib/telegram/bot/types/external_reply_info.rb +1 -0
  25. data/lib/telegram/bot/types/game.rb +1 -1
  26. data/lib/telegram/bot/types/inline_keyboard_button.rb +1 -0
  27. data/lib/telegram/bot/types/inline_keyboard_markup.rb +1 -0
  28. data/lib/telegram/bot/types/input_checklist.rb +1 -1
  29. data/lib/telegram/bot/types/input_checklist_task.rb +1 -1
  30. data/lib/telegram/bot/types/input_message_content.rb +3 -1
  31. data/lib/telegram/bot/types/input_rich_block.rb +3 -0
  32. data/lib/telegram/bot/types/input_rich_block_buttons.rb +13 -0
  33. data/lib/telegram/bot/types/input_rich_block_document.rb +13 -0
  34. data/lib/telegram/bot/types/input_rich_block_expandable_block_quotation.rb +13 -0
  35. data/lib/telegram/bot/types/input_rich_block_map.rb +3 -3
  36. data/lib/telegram/bot/types/input_rich_block_table.rb +1 -0
  37. data/lib/telegram/bot/types/input_rich_message_media.rb +2 -1
  38. data/lib/telegram/bot/types/input_shared_widget_message_content.rb +16 -0
  39. data/lib/telegram/bot/types/input_widget_message_content.rb +21 -0
  40. data/lib/telegram/bot/types/message.rb +4 -0
  41. data/lib/telegram/bot/types/message_generation_stopped.rb +13 -0
  42. data/lib/telegram/bot/types/paid_messages_waived.rb +10 -0
  43. data/lib/telegram/bot/types/poll.rb +1 -1
  44. data/lib/telegram/bot/types/reply_keyboard_markup.rb +1 -0
  45. data/lib/telegram/bot/types/reply_parameters.rb +1 -0
  46. data/lib/telegram/bot/types/rich_block.rb +3 -0
  47. data/lib/telegram/bot/types/rich_block_buttons.rb +13 -0
  48. data/lib/telegram/bot/types/rich_block_document.rb +13 -0
  49. data/lib/telegram/bot/types/rich_block_expandable_block_quotation.rb +13 -0
  50. data/lib/telegram/bot/types/rich_block_table.rb +1 -0
  51. data/lib/telegram/bot/types/rich_message_button.rb +21 -0
  52. data/lib/telegram/bot/types/rich_text.rb +2 -0
  53. data/lib/telegram/bot/types/rich_text_button.rb +12 -0
  54. data/lib/telegram/bot/types/rich_text_ton_address.rb +13 -0
  55. data/lib/telegram/bot/types/shared_widget_query.rb +15 -0
  56. data/lib/telegram/bot/types/story_area.rb +1 -1
  57. data/lib/telegram/bot/types/text_quote.rb +1 -0
  58. data/lib/telegram/bot/types/ton_nft.rb +17 -0
  59. data/lib/telegram/bot/types/ton_nft_attribute.rb +12 -0
  60. data/lib/telegram/bot/types/ton_wallet_card.rb +14 -0
  61. data/lib/telegram/bot/types/ton_wallet_card_sticker.rb +12 -0
  62. data/lib/telegram/bot/types/ton_wallet_transfer.rb +14 -0
  63. data/lib/telegram/bot/types/unique_gift_info.rb +3 -0
  64. data/lib/telegram/bot/types/update.rb +3 -0
  65. data/lib/telegram/bot/types/widget.rb +16 -0
  66. data/lib/telegram/bot/types/widget_query.rb +20 -0
  67. data/lib/telegram/bot/types/widget_query_type.rb +16 -0
  68. data/lib/telegram/bot/types/widget_query_type_data.rb +12 -0
  69. data/lib/telegram/bot/types/widget_query_type_sent_transaction.rb +13 -0
  70. data/lib/telegram/bot/types/widget_query_type_sign_data.rb +13 -0
  71. data/lib/telegram/bot/types/widget_query_wallet.rb +14 -0
  72. data/lib/telegram/bot/version.rb +1 -1
  73. data/rakelib/README.md +116 -0
  74. data/rakelib/builders/type_builder.rb +3 -4
  75. data/rakelib/docs.rake +15 -0
  76. data/rakelib/parse.rake +8 -25
  77. data/rakelib/parsers/api_method.rb +26 -0
  78. data/rakelib/parsers/description.rb +62 -0
  79. data/rakelib/parsers/docs_page.rb +62 -0
  80. data/rakelib/parsers/entry.rb +45 -0
  81. data/rakelib/parsers/entry_grammar.rb +48 -0
  82. data/rakelib/parsers/error.rb +5 -0
  83. data/rakelib/parsers/field.rb +30 -0
  84. data/rakelib/parsers/object_type.rb +29 -0
  85. data/rakelib/parsers/page_object.rb +41 -0
  86. data/rakelib/parsers/readers.rb +16 -0
  87. data/rakelib/parsers/return_type.rb +36 -0
  88. data/rakelib/parsers/serializer.rb +93 -0
  89. data/rakelib/parsers/table.rb +14 -0
  90. data/rakelib/parsers/type_ref.rb +42 -0
  91. data/rakelib/parsers/union_type.rb +42 -0
  92. metadata +60 -5
  93. data/.claude/skills/update-api/SKILL.md +0 -70
  94. data/rakelib/parsers/methods_parser.rb +0 -115
  95. data/rakelib/parsers/types_parser.rb +0 -283
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5b5d66a75d365647e9866d4ee8b5d624a65e6033b5ca6db9d6131d434876ef2
4
- data.tar.gz: bccb870d24d0b0a46834cd5b02d171872782febc59a69b30a9bd8d2920176fdd
3
+ metadata.gz: 811d9386bc12035ad8683176592b236f15c0a37d50e255a4c9a8140adad8677a
4
+ data.tar.gz: f6aebdaee858a97d59ec00a1b6b23d2d1a25d501311530e28cdedd5b970c5fe2
5
5
  SHA512:
6
- metadata.gz: 4156a631585d04798131196b5d50220dffbd221e253b445056216c0fbdcdd415b668266a260a41dc5e021dd3ad1697de24858b6d90387e21164fa2496d373ce1
7
- data.tar.gz: fe25f0dacbc6beaca8fdb6ae6a8e56841cfd64f017d2c95db982b520c4872acedcc48315ccfa9dbbd33d192bf5efae40b706090e63e7bc7dcdedf16f859adc65
6
+ metadata.gz: f9472750fce1eec6ce1f91074b8ef4fb830f162fd6c6ee9564901b9f67656edca9bf45dd84f72b856e3c874c6e890b05eddb41f0a4205ad3f45cd6380a3e500a
7
+ data.tar.gz: 572f10343ea270f1ddc2944aed0d5c0bd4676fe51473ebcd1a707cb2d1bad26de0774fba08c3f8355d32bce2ab4c695f53cbdfe402bd5da76176f09bc7929854
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: commit
3
+ description: Commit current changes as Conventional Commits, split by concern. Use when asked to commit changes or write a commit message.
4
+ ---
5
+
6
+ 1. Review `git status --short` and `git diff HEAD`, and read untracked files in full — the diff doesn't show them. Check staged and unstaged changes separately so existing staging choices aren't lost.
7
+
8
+ 2. Split changes into one commit per concern. Keep implementation, tests, documentation and generated files together when they support the same change. Separate unrelated changes; each commit should be coherent and independently valid. Adding paths does not exclude changes already staged. For whole-file commits, use `git commit --only -- <paths>` to leave unrelated staged files out of the commit. For selected hunks, preserve unrelated staged changes, temporarily remove them from the index, stage the approved hunks via `git apply --cached`, and verify `git diff --cached` contains only that concern before committing. Restore unrelated staging afterward, including if the commit fails. Do not use `--only` for selected-hunk commits: it takes whole files from the working tree.
9
+
10
+ 3. Message format: [Conventional Commits](https://www.conventionalcommits.org) — `type(scope): subject`, all lowercase, imperative, no trailing period, about 50 characters, in English.
11
+
12
+ Types: `feat`, `fix`, `refactor`, `perf`, `test`, `docs`, `style`, `build`, `ci`, `chore`, `revert`. Scope is the affected area (`api`, `types`, `parser`); omit it when the change spans many.
13
+
14
+ Add a body only when the subject doesn't explain the change: what changed and why, wrapped at 72 characters. Footers: `BREAKING CHANGE: …` for incompatible changes; `Refs: #123` for a related GitHub issue, when known. Never invent issue references.
15
+
16
+ Append an `Assisted-by: <agent-name>/<model-id>` Git trailer to every commit message, including message-only proposals. Use the actual agent name and model ID from the current session; if unavailable, ask rather than guess. Place trailers at the end of the message, separated from the subject or body by a blank line.
17
+
18
+ 4. Show the planned commits (files + messages) and wait for approval before staging or committing. If asked only for a commit message, return the proposed message without staging or committing.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: update-api
3
+ description: Update the generated types and endpoints to the latest Telegram Bot API
4
+ ---
5
+
6
+ Update the gem to the latest Telegram Bot API. `rakelib/README.md` explains how the parser works and where to fix it when it fails.
7
+
8
+ ## 1. Fetch the docs
9
+
10
+ Record HEAD and the highest supported Bot API version in `CHANGELOG.md` (not the gem version). Keep this baseline even if the changelog changes; compare versions numerically.
11
+
12
+ ```
13
+ bundle exec rake docs:fetch
14
+ ```
15
+
16
+ Always run step 5, even if the HTML is unchanged. Check the old and fetched documentation versions:
17
+
18
+ ```
19
+ git show HEAD:data/bot_api.html | grep -oEm1 'Bot API [0-9]+\.[0-9]+'
20
+ grep -oEm1 'Bot API [0-9]+\.[0-9]+' data/bot_api.html
21
+ ```
22
+
23
+ Fetch <https://core.telegram.org/bots/api-changelog>. Build a checklist from every release above the changelog baseline, including intermediate and patch releases.
24
+
25
+ ## 2. Parse
26
+
27
+ ```
28
+ bundle exec rake parse:types parse:methods
29
+ ```
30
+
31
+ On `Parsers::Error`, fix the unsupported markup in the parser, add a regression spec, and retry. Never hand-edit the JSON.
32
+
33
+ ## 3. Rebuild
34
+
35
+ ```
36
+ bundle exec rake rebuild:types rebuild:methods
37
+ ```
38
+
39
+ Rebuilding overwrites hand-written methods and aliases. Find affected files:
40
+
41
+ ```
42
+ git diff -G'^\s*(def|alias) ' --stat -- lib/telegram/bot/types
43
+ ```
44
+
45
+ Restore removed methods and aliases from the diff; keep everything else generated.
46
+
47
+ ## 4. Check
48
+
49
+ ```
50
+ bundle exec rubocop -a
51
+ bundle exec rspec
52
+ ```
53
+
54
+ Fix remaining failures. Read new field descriptions for defaults, fixed values and size limits missing from `data/types.json`; unfamiliar wording can escape the parser.
55
+
56
+ ## 5. Verify independently
57
+
58
+ Delegate verification to an independent, read-only subagent with fresh context. Fill in this self-contained brief:
59
+
60
+ > Verify Telegram Bot API coverage in the repository at `<absolute repo path>`. Baseline: Bot API `<baseline>` from `CHANGELOG.md` at `<original HEAD>`; target: `<fetched version>`; changed files: `<files>`. Inspect the resulting code and all staged, unstaged and relevant untracked changes. Do not edit or delegate.
61
+ >
62
+ > Independently fetch <https://core.telegram.org/bots/api-changelog> and read EVERY release numerically above the baseline, including intermediate and patch releases. Do not rely on the parent's checklist. Releases newer than the target mean the update is incomplete.
63
+ >
64
+ > Verify every item against `data/{types,methods}.json`, `lib/telegram/bot/types`, API dispatch/response handling, parser/rebuild code and specs; consult linked API docs as needed. Cover added, changed and removed types, methods, fields, parameters, return types, defaults, fixed values and constraints. Names and diff stats alone are not evidence.
65
+ >
66
+ > Return the baseline, versions reviewed and a per-version checklist with file:line evidence for every item: implemented, already supported, not applicable (explain why), missing or uncertain. Include fixes and tests needed for gaps. Failed fetches or incomplete review block verification; never report success for unchecked items.
67
+
68
+ Fix gaps, rerun step 4, and have the subagent recheck missing or uncertain items. Completion requires every item accounted for and verification passed; report blockers explicitly.
69
+
70
+ Summarize additions, changes, removals, verified versions and remaining blockers.
data/.claude/skills ADDED
@@ -0,0 +1 @@
1
+ ../.agents/skills
data/.rubocop.yml CHANGED
@@ -22,24 +22,10 @@ Metrics/ClassLength:
22
22
  - lib/telegram/bot/api/endpoints.rb
23
23
  - lib/telegram/bot/types/message.rb
24
24
  - rakelib/builders/type_builder.rb
25
- - rakelib/parsers/**/*
26
25
 
27
26
  Metrics/MethodLength:
28
27
  Exclude:
29
28
  - spec/**/*
30
- - rakelib/parsers/**/*
31
-
32
- Metrics/AbcSize:
33
- Exclude:
34
- - rakelib/parsers/**/*
35
-
36
- Metrics/CyclomaticComplexity:
37
- Exclude:
38
- - rakelib/parsers/**/*
39
-
40
- Metrics/PerceivedComplexity:
41
- Exclude:
42
- - rakelib/parsers/**/*
43
29
 
44
30
  Layout/LineLength:
45
31
  Max: 120
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.9.0
4
+
5
+ ### Added
6
+
7
+ - [Bot API 10.3](https://core.telegram.org/bots/api-changelog#august-24-2026) + [Bot API 10.4](https://core.telegram.org/bots/api-changelog#november-9-2026) [#345](https://github.com/atipugin/telegram-bot-ruby/pull/345)
8
+
9
+ ### Changed
10
+
11
+ - Story areas now use `AreaPosition`, renamed from `StoryAreaPosition` in Bot API 10.4. The old class remains available for compatibility.
12
+
13
+ ### Fixed
14
+
15
+ - Parse conditional field requirements without treating them as unconditional fixed values.
16
+ - Preserve minimum-only and maximum-only size constraints when generating types, including the 32-item rich-quote limit.
17
+ - Leave text limits measured after entity parsing to Telegram instead of constraining raw Markdown or HTML.
18
+
3
19
  ## 2.8.1
4
20
 
5
21
  ### Fixed
data/README.md CHANGED
@@ -266,11 +266,19 @@ end
266
266
 
267
267
  ## Maintenance
268
268
 
269
- 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.
269
+ 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. See [rakelib/README.md](rakelib/README.md) for how the parser works.
270
+
271
+ ### Fetching
272
+
273
+ Download the latest documentation to the snapshot kept in the repository:
274
+
275
+ ```shell
276
+ rake docs:fetch # Downloads the documentation to data/bot_api.html
277
+ ```
270
278
 
271
279
  ### Parsing
272
280
 
273
- Parse types and methods from the official documentation:
281
+ Parse types and methods from the snapshot:
274
282
 
275
283
  ```shell
276
284
  rake parse:types # Parses types to data/types.json
@@ -286,6 +294,12 @@ rake rebuild:types # Rebuilds lib/telegram/bot/types/*.rb
286
294
  rake rebuild:methods # Rebuilds lib/telegram/bot/api/endpoints.rb
287
295
  ```
288
296
 
297
+ `rebuild:types` overwrites every type file, including the few that contain hand-written methods. List the files that lost a method, restore those methods, then run the specs and RuboCop:
298
+
299
+ ```shell
300
+ git diff -G'^\s*(def|alias) ' --stat -- lib/telegram/bot/types
301
+ ```
302
+
289
303
  ## Contributing
290
304
 
291
305
  1. Fork it.
@@ -24,6 +24,8 @@ module Telegram
24
24
  'sendAnimation' => Types::Message,
25
25
  'sendVoice' => Types::Message,
26
26
  'sendVideoNote' => Types::Message,
27
+ 'sendWidget' => Types::Message,
28
+ 'sendSharedWidget' => Types::Message,
27
29
  'sendPaidMedia' => Types::Message,
28
30
  'sendMediaGroup' => Types::Array.of(Types::Message),
29
31
  'sendLocation' => Types::Message,
@@ -68,7 +70,9 @@ module Telegram
68
70
  'leaveChat' => Types::Bool,
69
71
  'getChat' => Types::ChatFullInfo,
70
72
  'getChatAdministrators' => Types::Array.of(Types::ChatMember),
73
+ 'getChatMemberCount' => Types::Integer,
71
74
  'getChatMember' => Types::ChatMember,
75
+ 'getChatShareThemeBackdrops' => Types::ChatShareThemeBackdrops,
72
76
  'getUserPersonalChatMessages' => Types::Array.of(Types::Message),
73
77
  'setChatStickerSet' => Types::Bool,
74
78
  'deleteChatStickerSet' => Types::Bool,
@@ -86,6 +90,7 @@ module Telegram
86
90
  'unhideGeneralForumTopic' => Types::Bool,
87
91
  'unpinAllGeneralForumTopicMessages' => Types::Bool,
88
92
  'answerCallbackQuery' => Types::Bool,
93
+ 'answerWidgetQuery' => Types::Bool,
89
94
  'answerGuestQuery' => Types::SentGuestMessage,
90
95
  'getUserChatBoosts' => Types::UserChatBoosts,
91
96
  'getBusinessConnection' => Types::BusinessConnection,
@@ -128,9 +133,11 @@ module Telegram
128
133
  'getBusinessAccountGifts' => Types::OwnedGifts,
129
134
  'getUserGifts' => Types::OwnedGifts,
130
135
  'getChatGifts' => Types::OwnedGifts,
136
+ 'getUniqueGift' => Types::UniqueGift,
131
137
  'convertGiftToStars' => Types::Bool,
132
138
  'upgradeGift' => Types::Bool,
133
139
  'transferGift' => Types::Bool,
140
+ 'deleteBusinessAccountGift' => Types::Bool,
134
141
  'postStory' => Types::Story,
135
142
  'repostStory' => Types::Story,
136
143
  'editStory' => Types::Story,
@@ -144,6 +151,8 @@ module Telegram
144
151
  'editMessageLiveLocation' => Types::Message | Types::Bool,
145
152
  'stopMessageLiveLocation' => Types::Message | Types::Bool,
146
153
  'editMessageChecklist' => Types::Message,
154
+ 'editMessageWidgetData' => Types::Bool,
155
+ 'editSharedWidgetData' => Types::Bool,
147
156
  'editMessageReplyMarkup' => Types::Message | Types::Bool,
148
157
  'stopPoll' => Types::Poll,
149
158
  'editEphemeralMessageText' => Types::Bool,
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class AreaPosition < Base
7
+ attribute :x_percentage, Types::Float
8
+ attribute :y_percentage, Types::Float
9
+ attribute :width_percentage, Types::Float
10
+ attribute :height_percentage, Types::Float
11
+ attribute :rotation_angle, Types::Float
12
+ attribute :corner_radius_percentage, Types::Float
13
+ end
14
+ end
15
+ end
16
+ end
@@ -21,6 +21,7 @@ module Telegram
21
21
  attribute? :can_manage_topics, Types::Bool
22
22
  attribute? :can_manage_direct_messages, Types::Bool
23
23
  attribute? :can_manage_tags, Types::Bool
24
+ attribute :can_send_welcome_messages, Types::Bool
24
25
  end
25
26
  end
26
27
  end
@@ -57,6 +57,8 @@ module Telegram
57
57
  attribute? :paid_message_star_count, Types::Integer
58
58
  attribute? :guard_bot, User
59
59
  attribute? :community, Community
60
+ attribute? :ton_wallet_card, TonWalletCard
61
+ attribute? :share_theme, ChatShareTheme
60
62
  end
61
63
  end
62
64
  end
@@ -24,6 +24,7 @@ module Telegram
24
24
  attribute? :can_manage_topics, Types::Bool
25
25
  attribute? :can_manage_direct_messages, Types::Bool
26
26
  attribute? :can_manage_tags, Types::Bool
27
+ attribute :can_send_welcome_messages, Types::Bool
27
28
  attribute? :custom_title, Types::String
28
29
  end
29
30
  end
@@ -0,0 +1,15 @@
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
+ ChatShareTheme = (
9
+ ChatShareThemeEmoji |
10
+ ChatShareThemeUniqueGift
11
+ )
12
+ # rubocop:enable Naming/ConstantName
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 ChatShareThemeBackdrop < Base
7
+ attribute :id, Types::Integer
8
+ attribute :name, Types::String
9
+ attribute :colors, UniqueGiftBackdropColors
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 ChatShareThemeBackdrops < Base
7
+ attribute :backdrops, Types::Array.of(ChatShareThemeBackdrop)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ChatShareThemeEmoji < Base
7
+ attribute :type, Types::String.constrained(eql: 'emoji').default('emoji')
8
+ attribute :emojis, Types::Array.of(EmojiType).constrained(min_size: 0, max_size: 6)
9
+ attribute? :background_backdrop_id, 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 ChatShareThemeUniqueGift < Base
7
+ attribute :type, Types::String.constrained(eql: 'unique_gift').default('unique_gift')
8
+ attribute :gift, UniqueGift
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 CommunityChatJoined < Base
7
+ attribute :community, Community
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class DisabledButton < Base
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
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
+ EmojiType = (
9
+ EmojiTypeEmoji |
10
+ EmojiTypeCustomEmoji
11
+ )
12
+ # rubocop:enable Naming/ConstantName
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
+ class EmojiTypeCustomEmoji < Base
7
+ attribute :type, Types::String.constrained(eql: 'custom_emoji').default('custom_emoji')
8
+ attribute :custom_emoji_id, Types::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 EmojiTypeEmoji < Base
7
+ attribute :type, Types::String.constrained(eql: 'emoji').default('emoji')
8
+ attribute :emoji, 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 EphemeralMessageParameters < Base
7
+ attribute? :receiver_user_id, Types::Integer
8
+ attribute? :callback_query_id, Types::String
9
+ attribute? :replace_callback_query_message, Types::Bool
10
+ end
11
+ end
12
+ end
13
+ end
@@ -19,6 +19,7 @@ module Telegram
19
19
  attribute? :video, Video
20
20
  attribute? :video_note, VideoNote
21
21
  attribute? :voice, Voice
22
+ attribute? :widget, Widget
22
23
  attribute? :has_media_spoiler, Types::True
23
24
  attribute? :checklist, Checklist
24
25
  attribute? :contact, Contact
@@ -7,7 +7,7 @@ module Telegram
7
7
  attribute :title, Types::String
8
8
  attribute :description, Types::String
9
9
  attribute :photo, Types::Array.of(PhotoSize)
10
- attribute? :text, Types::String
10
+ attribute? :text, Types::String.constrained(max_size: 4096)
11
11
  attribute? :text_entities, Types::Array.of(MessageEntity)
12
12
  attribute? :animation, Animation
13
13
  end
@@ -17,6 +17,7 @@ module Telegram
17
17
  attribute? :copy_text, CopyTextButton
18
18
  attribute? :callback_game, CallbackGame
19
19
  attribute? :pay, Types::Bool
20
+ attribute? :disabled, DisabledButton
20
21
  end
21
22
  end
22
23
  end
@@ -5,6 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class InlineKeyboardMarkup < Base
7
7
  attribute :inline_keyboard, Types::Array.of(Types::Array.of(InlineKeyboardButton))
8
+ attribute? :force_reply, Types::Bool
8
9
 
9
10
  def to_compact_hash
10
11
  hsh = super
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputChecklist < Base
7
- attribute :title, Types::String.constrained(min_size: 1, max_size: 255)
7
+ attribute :title, Types::String
8
8
  attribute? :parse_mode, Types::String
9
9
  attribute? :title_entities, Types::Array.of(MessageEntity)
10
10
  attribute :tasks, Types::Array.of(InputChecklistTask)
@@ -5,7 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class InputChecklistTask < Base
7
7
  attribute :id, Types::Integer
8
- attribute :text, Types::String.constrained(min_size: 1, max_size: 100)
8
+ attribute :text, Types::String
9
9
  attribute? :parse_mode, Types::String
10
10
  attribute? :text_entities, Types::Array.of(MessageEntity)
11
11
  end
@@ -11,7 +11,9 @@ module Telegram
11
11
  InputLocationMessageContent |
12
12
  InputVenueMessageContent |
13
13
  InputContactMessageContent |
14
- InputInvoiceMessageContent
14
+ InputInvoiceMessageContent |
15
+ InputWidgetMessageContent |
16
+ InputSharedWidgetMessageContent
15
17
  )
16
18
  # rubocop:enable Naming/ConstantName
17
19
  end
@@ -15,14 +15,17 @@ module Telegram
15
15
  InputRichBlockAnchor |
16
16
  InputRichBlockList |
17
17
  InputRichBlockBlockQuotation |
18
+ InputRichBlockExpandableBlockQuotation |
18
19
  InputRichBlockPullQuotation |
19
20
  InputRichBlockCollage |
20
21
  InputRichBlockSlideshow |
21
22
  InputRichBlockTable |
22
23
  InputRichBlockDetails |
23
24
  InputRichBlockMap |
25
+ InputRichBlockButtons |
24
26
  InputRichBlockAnimation |
25
27
  InputRichBlockAudio |
28
+ InputRichBlockDocument |
26
29
  InputRichBlockPhoto |
27
30
  InputRichBlockVideo |
28
31
  InputRichBlockVoiceNote |
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputRichBlockButtons < Base
7
+ attribute :type, Types::String.constrained(eql: 'buttons').default('buttons')
8
+ attribute :buttons, Types::Array.of(RichMessageButton).constrained(min_size: 1, max_size: 8)
9
+ attribute? :align, 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 InputRichBlockDocument < Base
7
+ attribute :type, Types::String.constrained(eql: 'document').default('document')
8
+ attribute :document, InputMediaDocument
9
+ attribute? :caption, RichBlockCaption
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 InputRichBlockExpandableBlockQuotation < Base
7
+ attribute :type, Types::String.constrained(eql: 'expandable_blockquote').default('expandable_blockquote')
8
+ attribute :text, RichText
9
+ attribute? :credit, RichText
10
+ end
11
+ end
12
+ end
13
+ end
@@ -6,9 +6,9 @@ module Telegram
6
6
  class InputRichBlockMap < Base
7
7
  attribute :type, Types::String.constrained(eql: 'map').default('map')
8
8
  attribute :location, Location
9
- attribute :zoom, Types::Integer
10
- attribute :width, Types::Integer
11
- attribute :height, Types::Integer
9
+ attribute? :zoom, Types::Integer
10
+ attribute? :width, Types::Integer
11
+ attribute? :height, Types::Integer
12
12
  attribute? :caption, RichBlockCaption
13
13
  end
14
14
  end
@@ -8,6 +8,7 @@ module Telegram
8
8
  attribute :cells, Types::Array.of(Types::Array.of(RichBlockTableCell))
9
9
  attribute? :is_bordered, Types::True
10
10
  attribute? :is_striped, Types::True
11
+ attribute? :is_compact, Types::True
11
12
  attribute? :caption, RichText
12
13
  end
13
14
  end
@@ -6,7 +6,8 @@ module Telegram
6
6
  class InputRichMessageMedia < Base
7
7
  attribute :id, Types::String.constrained(min_size: 1, max_size: 64)
8
8
  attribute :media,
9
- InputMediaAnimation | InputMediaAudio | InputMediaPhoto | InputMediaVideo | InputMediaVoiceNote
9
+ InputMediaAnimation | InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo |
10
+ InputMediaVoiceNote
10
11
  end
11
12
  end
12
13
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputSharedWidgetMessageContent < Base
7
+ attribute :widget_id, Types::String
8
+ attribute? :chat_data, Types::String
9
+ attribute? :caption, Types::String
10
+ attribute? :parse_mode, Types::String
11
+ attribute? :caption_entities, Types::Array.of(MessageEntity)
12
+ attribute? :show_caption_above_media, Types::Bool
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class InputWidgetMessageContent < Base
7
+ attribute :html, Types::String
8
+ attribute? :width, Types::Integer
9
+ attribute? :height, Types::Integer
10
+ attribute? :public_data, Types::String
11
+ attribute? :chat_data, Types::String
12
+ attribute? :caption, Types::String
13
+ attribute? :parse_mode, Types::String
14
+ attribute? :caption_entities, Types::Array.of(MessageEntity)
15
+ attribute? :show_caption_above_media, Types::Bool
16
+ attribute? :allow_queries, Types::Bool
17
+ attribute? :is_shared, Types::Bool
18
+ end
19
+ end
20
+ end
21
+ end