Skip to content

Commit cb973d9

Browse files
committed
Update to Bot API 8.2
1 parent 7c30022 commit cb973d9

File tree

6 files changed

+63
-27
lines changed

6 files changed

+63
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
# 0.16.7
4+
5+
- Update to Bot API 8.2
6+
37
# 0.16.6
48

59
- Fix poller rake task for Rails 8.0

bin/fetch-telegram-methods

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,24 @@ puts result_txt
4141
API_METHODS_FILE = File.expand_path('../lib/telegram/bot/client/api_methods.txt', __dir__).freeze
4242
File.write(API_METHODS_FILE, result_txt)
4343
puts '', "Updated #{API_METHODS_FILE}"
44+
45+
46+
puts '', 'Payload types:'
47+
update_tbody = doc.css('tbody').
48+
find { |tbody| tbody.css('td').any? { |td| td.text == 'update_id' } }
49+
payload_types = update_tbody.css('td:first-child').map(&:text).reject { |x| x == 'update_id' }
50+
51+
result = ['# Generated with bin/fetch-telegram-methods']
52+
result << "# #{api_version[1]}" if api_version
53+
result << payload_types.join("\n")
54+
result << ''
55+
result_txt = result.join("\n")
56+
57+
puts result_txt
58+
59+
PAYLOAD_TYPES_FILE = File.expand_path(
60+
'../lib/telegram/bot/updates_controller/payload_types.txt',
61+
__dir__,
62+
).freeze
63+
File.write(PAYLOAD_TYPES_FILE, result_txt)
64+
puts '', "Updated #{PAYLOAD_TYPES_FILE}"

lib/telegram/bot/client/api_methods.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Generated with bin/fetch-telegram-methods
2-
# Bot API 8.0
2+
# Bot API 8.2
33

44
getUpdates
55
setWebhook
@@ -121,6 +121,10 @@ setCustomEmojiStickerSetThumbnail
121121
deleteStickerSet
122122
getAvailableGifts
123123
sendGift
124+
verifyUser
125+
verifyChat
126+
removeUserVerification
127+
removeChatVerification
124128

125129
answerInlineQuery
126130
answerWebAppQuery

lib/telegram/bot/updates_controller.rb

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,13 @@ class UpdatesController < AbstractController::Base # rubocop:disable Metrics/Cla
8989

9090
extend Session::ConfigMethods
9191

92-
PAYLOAD_TYPES = Set.new(%w[
93-
message
94-
edited_message
95-
channel_post
96-
edited_channel_post
97-
business_connection
98-
business_message
99-
edited_business_message
100-
deleted_business_messages
101-
message_reaction
102-
message_reaction_count
103-
inline_query
104-
chosen_inline_result
105-
callback_query
106-
shipping_query
107-
pre_checkout_query
108-
purchased_paid_media
109-
poll
110-
poll_answer
111-
my_chat_member
112-
chat_member
113-
chat_join_request
114-
chat_boost
115-
removed_chat_boost
116-
].freeze)
92+
PAYLOAD_TYPES_FILE = File.expand_path('updates_controller/payload_types.txt', __dir__)
93+
PAYLOAD_TYPES = File.read(PAYLOAD_TYPES_FILE).
94+
lines.
95+
map(&:strip).
96+
reject { |x| x.empty? || x.start_with?('#') }.
97+
to_set.
98+
freeze
11799

118100
class << self
119101
# Initialize controller and process update.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated with bin/fetch-telegram-methods
2+
# Bot API 8.2
3+
message
4+
edited_message
5+
channel_post
6+
edited_channel_post
7+
business_connection
8+
business_message
9+
edited_business_message
10+
deleted_business_messages
11+
message_reaction
12+
message_reaction_count
13+
inline_query
14+
chosen_inline_result
15+
callback_query
16+
shipping_query
17+
pre_checkout_query
18+
purchased_paid_media
19+
poll
20+
poll_answer
21+
my_chat_member
22+
chat_member
23+
chat_join_request
24+
chat_boost
25+
removed_chat_boost

lib/telegram/bot/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Telegram
44
module Bot
5-
VERSION = '0.16.6'
5+
VERSION = '0.16.7'
66

77
def self.gem_version
88
Gem::Version.new VERSION

0 commit comments

Comments
 (0)