telegram-bot-ruby 0.16.0 → 0.19.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -3
- data/CHANGELOG.md +18 -0
- data/Gemfile +2 -0
- data/Rakefile +3 -1
- data/examples/bot.rb +2 -0
- data/lib/telegram/bot/api.rb +11 -5
- data/lib/telegram/bot/client.rb +4 -3
- data/lib/telegram/bot/configuration.rb +5 -1
- data/lib/telegram/bot/exceptions/base.rb +2 -0
- data/lib/telegram/bot/exceptions/response_error.rb +3 -0
- data/lib/telegram/bot/exceptions.rb +2 -0
- data/lib/telegram/bot/null_logger.rb +3 -1
- data/lib/telegram/bot/types/animation.rb +2 -0
- data/lib/telegram/bot/types/audio.rb +2 -0
- data/lib/telegram/bot/types/base.rb +2 -0
- data/lib/telegram/bot/types/bot_command.rb +12 -0
- data/lib/telegram/bot/types/bot_command_scope_all_chat_administrators.rb +11 -0
- data/lib/telegram/bot/types/bot_command_scope_all_group_chats.rb +11 -0
- data/lib/telegram/bot/types/bot_command_scope_all_private_chats.rb +11 -0
- data/lib/telegram/bot/types/bot_command_scope_chat.rb +12 -0
- data/lib/telegram/bot/types/bot_command_scope_chat_administrators.rb +12 -0
- data/lib/telegram/bot/types/bot_command_scope_chat_member.rb +13 -0
- data/lib/telegram/bot/types/bot_command_scope_default.rb +11 -0
- data/lib/telegram/bot/types/callback_game.rb +2 -0
- data/lib/telegram/bot/types/callback_query.rb +2 -0
- data/lib/telegram/bot/types/chat.rb +9 -1
- data/lib/telegram/bot/types/chat_administrator_rights.rb +21 -0
- data/lib/telegram/bot/types/chat_invite_link.rb +5 -0
- data/lib/telegram/bot/types/chat_join_request.rb +15 -0
- data/lib/telegram/bot/types/chat_location.rb +2 -0
- data/lib/telegram/bot/types/chat_member.rb +3 -1
- data/lib/telegram/bot/types/chat_member_updated.rb +2 -0
- data/lib/telegram/bot/types/chat_permissions.rb +2 -0
- data/lib/telegram/bot/types/chat_photo.rb +2 -0
- data/lib/telegram/bot/types/chosen_inline_result.rb +2 -0
- data/lib/telegram/bot/types/compactable.rb +4 -2
- data/lib/telegram/bot/types/contact.rb +2 -0
- data/lib/telegram/bot/types/dice.rb +2 -0
- data/lib/telegram/bot/types/document.rb +2 -0
- data/lib/telegram/bot/types/encrypted_credentials.rb +2 -0
- data/lib/telegram/bot/types/encrypted_passport_element.rb +2 -0
- data/lib/telegram/bot/types/file.rb +2 -0
- data/lib/telegram/bot/types/force_reply.rb +3 -0
- data/lib/telegram/bot/types/game.rb +2 -0
- data/lib/telegram/bot/types/game_high_score.rb +2 -0
- data/lib/telegram/bot/types/inline_keyboard_button.rb +4 -1
- data/lib/telegram/bot/types/inline_keyboard_markup.rb +2 -0
- data/lib/telegram/bot/types/inline_query.rb +4 -1
- data/lib/telegram/bot/types/inline_query_result_article.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_audio.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_document.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_video.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_contact.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_document.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_game.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_gif.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_location.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_photo.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_venue.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_video.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_voice.rb +2 -0
- data/lib/telegram/bot/types/input_contact_message_content.rb +2 -0
- data/lib/telegram/bot/types/input_invoice_message_content.rb +30 -0
- data/lib/telegram/bot/types/input_location_message_content.rb +2 -0
- data/lib/telegram/bot/types/input_media_animation.rb +2 -0
- data/lib/telegram/bot/types/input_media_audio.rb +2 -0
- data/lib/telegram/bot/types/input_media_document.rb +2 -0
- data/lib/telegram/bot/types/input_media_photo.rb +2 -0
- data/lib/telegram/bot/types/input_media_video.rb +2 -0
- data/lib/telegram/bot/types/input_message_content.rb +2 -0
- data/lib/telegram/bot/types/input_text_message_content.rb +2 -0
- data/lib/telegram/bot/types/input_venue_message_content.rb +2 -0
- data/lib/telegram/bot/types/invoice.rb +2 -0
- data/lib/telegram/bot/types/keyboard_button.rb +3 -0
- data/lib/telegram/bot/types/keyboard_button_poll_type.rb +2 -0
- data/lib/telegram/bot/types/labeled_price.rb +2 -0
- data/lib/telegram/bot/types/location.rb +2 -0
- data/lib/telegram/bot/types/login_url.rb +2 -0
- data/lib/telegram/bot/types/mask_position.rb +2 -0
- data/lib/telegram/bot/types/menu_button_commands.rb +11 -0
- data/lib/telegram/bot/types/menu_button_default.rb +11 -0
- data/lib/telegram/bot/types/menu_button_web_app.rb +13 -0
- data/lib/telegram/bot/types/message.rb +15 -9
- data/lib/telegram/bot/types/message_auto_delete_timer_changed.rb +2 -0
- data/lib/telegram/bot/types/message_entity.rb +2 -0
- data/lib/telegram/bot/types/order_info.rb +2 -0
- data/lib/telegram/bot/types/passport_data.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_data_field.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_file.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_files.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_front_side.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_selfie.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_translation_file.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -0
- data/lib/telegram/bot/types/passport_element_error_unspecified.rb +2 -0
- data/lib/telegram/bot/types/passport_file.rb +2 -0
- data/lib/telegram/bot/types/pattern_matching.rb +2 -0
- data/lib/telegram/bot/types/photo_size.rb +2 -0
- data/lib/telegram/bot/types/poll.rb +2 -0
- data/lib/telegram/bot/types/poll_answer.rb +2 -0
- data/lib/telegram/bot/types/poll_option.rb +2 -0
- data/lib/telegram/bot/types/pre_checkout_query.rb +2 -0
- data/lib/telegram/bot/types/proximity_alert_triggered.rb +2 -0
- data/lib/telegram/bot/types/reply_keyboard_markup.rb +3 -0
- data/lib/telegram/bot/types/reply_keyboard_remove.rb +2 -0
- data/lib/telegram/bot/types/sent_web_app_message.rb +11 -0
- data/lib/telegram/bot/types/shipping_address.rb +2 -0
- data/lib/telegram/bot/types/shipping_option.rb +2 -0
- data/lib/telegram/bot/types/shipping_query.rb +2 -0
- data/lib/telegram/bot/types/sticker.rb +3 -0
- data/lib/telegram/bot/types/sticker_set.rb +3 -0
- data/lib/telegram/bot/types/successful_payment.rb +2 -0
- data/lib/telegram/bot/types/update.rb +3 -0
- data/lib/telegram/bot/types/user.rb +2 -0
- data/lib/telegram/bot/types/user_profile_photos.rb +2 -0
- data/lib/telegram/bot/types/venue.rb +2 -0
- data/lib/telegram/bot/types/video.rb +2 -0
- data/lib/telegram/bot/types/{voice_chat_ended.rb → video_chat_ended.rb} +3 -1
- data/lib/telegram/bot/types/{voice_chat_participants_invited.rb → video_chat_participants_invited.rb} +3 -1
- data/lib/telegram/bot/types/video_chat_scheduled.rb +11 -0
- data/lib/telegram/bot/types/{voice_chat_started.rb → video_chat_started.rb} +3 -1
- data/lib/telegram/bot/types/video_note.rb +2 -0
- data/lib/telegram/bot/types/voice.rb +2 -0
- data/lib/telegram/bot/types/web_app_data.rb +12 -0
- data/lib/telegram/bot/types/web_app_info.rb +11 -0
- data/lib/telegram/bot/types/webhook_info.rb +3 -1
- data/lib/telegram/bot/types.rb +25 -5
- data/lib/telegram/bot/version.rb +3 -1
- data/lib/telegram/bot.rb +2 -0
- data/telegram-bot-ruby.gemspec +9 -6
- metadata +55 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4a3f55636b586f9c0c40a020c0eec4686fe4c664946dcb560422c3082d82b6c
|
|
4
|
+
data.tar.gz: c44b6c28251b3183e5b3bb7256851d0b92f638bcc24b2fd4a188c21aa28beeca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 31c46eeb60c9c176ba58ba42811968e5c7b7db40849024f1626147f482c06a4e884843ed228a0a8391feeb69682521bec80d92ebac5fdb531dbadaa386193239
|
|
7
|
+
data.tar.gz: e3ec13011270299788f4e3e0329c98f9186621b669961e8c669d82a974b1579bf023f70f643071b4eefd5ceec69ebede0ff733cc935e207a2bcaaad9417b9b2e
|
data/.rubocop.yml
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
-
require:
|
|
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
|
-
|
|
13
|
+
IgnoredMethods:
|
|
9
14
|
- context
|
|
10
15
|
- describe
|
|
11
16
|
|
|
12
|
-
|
|
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
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
data/lib/telegram/bot/api.rb
CHANGED
|
@@ -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
|
|
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(
|
|
61
|
-
|
|
62
|
-
|
|
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
|
data/lib/telegram/bot/client.rb
CHANGED
|
@@ -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="
|
|
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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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 :
|
|
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,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
|
-
|
|
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,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,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
|