telegram-bot-ruby 0.23.0 → 1.0.0.pre
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/.env.sample +2 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -1
- data/README.md +25 -13
- data/Rakefile +43 -0
- data/lib/telegram/bot/types/animation.rb +9 -9
- data/lib/telegram/bot/types/audio.rb +9 -9
- data/lib/telegram/bot/types/base.rb +3 -2
- data/lib/telegram/bot/types/bot_command.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_all_chat_administrators.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_all_group_chats.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_all_private_chats.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_chat.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_chat_administrators.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_chat_member.rb +3 -3
- data/lib/telegram/bot/types/bot_command_scope_default.rb +1 -1
- data/lib/telegram/bot/types/callback_query.rb +6 -6
- data/lib/telegram/bot/types/chat.rb +27 -28
- data/lib/telegram/bot/types/chat_administrator_rights.rb +13 -12
- data/lib/telegram/bot/types/chat_invite_link.rb +8 -8
- data/lib/telegram/bot/types/chat_join_request.rb +3 -3
- data/lib/telegram/bot/types/chat_location.rb +1 -1
- data/lib/telegram/bot/types/chat_member.rb +0 -22
- data/lib/telegram/bot/types/chat_member_administrator.rb +26 -0
- data/lib/telegram/bot/types/chat_member_banned.rb +13 -0
- data/lib/telegram/bot/types/chat_member_left.rb +12 -0
- data/lib/telegram/bot/types/chat_member_member.rb +12 -0
- data/lib/telegram/bot/types/chat_member_owner.rb +14 -0
- data/lib/telegram/bot/types/chat_member_restricted.rb +23 -0
- data/lib/telegram/bot/types/chat_member_updated.rb +2 -2
- data/lib/telegram/bot/types/chat_permissions.rb +9 -8
- data/lib/telegram/bot/types/chat_photo.rb +4 -4
- data/lib/telegram/bot/types/chosen_inline_result.rb +4 -4
- data/lib/telegram/bot/types/contact.rb +5 -5
- data/lib/telegram/bot/types/dice.rb +2 -2
- data/lib/telegram/bot/types/document.rb +6 -6
- data/lib/telegram/bot/types/encrypted_credentials.rb +3 -3
- data/lib/telegram/bot/types/encrypted_passport_element.rb +10 -10
- data/lib/telegram/bot/types/file.rb +4 -4
- data/lib/telegram/bot/types/force_reply.rb +3 -3
- data/lib/telegram/bot/types/forum_topic.rb +14 -0
- data/lib/telegram/bot/types/forum_topic_closed.rb +10 -0
- data/lib/telegram/bot/types/forum_topic_created.rb +13 -0
- data/lib/telegram/bot/types/forum_topic_reopened.rb +10 -0
- data/lib/telegram/bot/types/game.rb +6 -6
- data/lib/telegram/bot/types/game_high_score.rb +2 -2
- data/lib/telegram/bot/types/inline_keyboard_button.rb +9 -9
- data/lib/telegram/bot/types/inline_keyboard_markup.rb +1 -1
- data/lib/telegram/bot/types/inline_query.rb +5 -5
- data/lib/telegram/bot/types/inline_query_result_article.rb +10 -10
- data/lib/telegram/bot/types/inline_query_result_audio.rb +11 -10
- data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +8 -7
- data/lib/telegram/bot/types/inline_query_result_cached_document.rb +10 -9
- data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +9 -8
- data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +9 -8
- data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +10 -9
- data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +5 -5
- data/lib/telegram/bot/types/inline_query_result_cached_video.rb +10 -9
- data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +9 -8
- data/lib/telegram/bot/types/inline_query_result_contact.rb +11 -11
- data/lib/telegram/bot/types/inline_query_result_document.rb +14 -13
- data/lib/telegram/bot/types/inline_query_result_game.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_gif.rb +14 -12
- data/lib/telegram/bot/types/inline_query_result_location.rb +14 -14
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +14 -13
- data/lib/telegram/bot/types/inline_query_result_photo.rb +13 -12
- data/lib/telegram/bot/types/inline_query_result_venue.rb +15 -15
- data/lib/telegram/bot/types/inline_query_result_video.rb +15 -14
- data/lib/telegram/bot/types/inline_query_result_voice.rb +10 -9
- data/lib/telegram/bot/types/input_contact_message_content.rb +4 -4
- data/lib/telegram/bot/types/input_invoice_message_content.rb +20 -20
- data/lib/telegram/bot/types/input_location_message_content.rb +6 -6
- data/lib/telegram/bot/types/input_media_animation.rb +9 -8
- data/lib/telegram/bot/types/input_media_audio.rb +9 -8
- data/lib/telegram/bot/types/input_media_document.rb +7 -7
- data/lib/telegram/bot/types/input_media_photo.rb +5 -4
- data/lib/telegram/bot/types/input_media_video.rb +10 -8
- data/lib/telegram/bot/types/input_text_message_content.rb +4 -3
- data/lib/telegram/bot/types/input_venue_message_content.rb +8 -8
- data/lib/telegram/bot/types/invoice.rb +5 -5
- data/lib/telegram/bot/types/keyboard_button.rb +5 -5
- data/lib/telegram/bot/types/keyboard_button_poll_type.rb +1 -1
- data/lib/telegram/bot/types/labeled_price.rb +2 -2
- data/lib/telegram/bot/types/location.rb +6 -6
- data/lib/telegram/bot/types/login_url.rb +4 -4
- data/lib/telegram/bot/types/mask_position.rb +4 -4
- data/lib/telegram/bot/types/menu_button_commands.rb +1 -1
- data/lib/telegram/bot/types/menu_button_default.rb +1 -1
- data/lib/telegram/bot/types/menu_button_web_app.rb +2 -2
- data/lib/telegram/bot/types/message.rb +63 -58
- data/lib/telegram/bot/types/message_auto_delete_timer_changed.rb +1 -1
- data/lib/telegram/bot/types/message_entity.rb +7 -7
- data/lib/telegram/bot/types/order_info.rb +4 -4
- data/lib/telegram/bot/types/passport_data.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_data_field.rb +5 -5
- data/lib/telegram/bot/types/passport_element_error_file.rb +4 -4
- data/lib/telegram/bot/types/passport_element_error_files.rb +4 -4
- data/lib/telegram/bot/types/passport_element_error_front_side.rb +4 -4
- data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +4 -4
- data/lib/telegram/bot/types/passport_element_error_selfie.rb +4 -4
- data/lib/telegram/bot/types/passport_element_error_translation_file.rb +4 -4
- data/lib/telegram/bot/types/passport_element_error_translation_files.rb +4 -4
- data/lib/telegram/bot/types/passport_element_error_unspecified.rb +4 -4
- data/lib/telegram/bot/types/passport_file.rb +4 -4
- data/lib/telegram/bot/types/photo_size.rb +5 -5
- data/lib/telegram/bot/types/poll.rb +13 -13
- data/lib/telegram/bot/types/poll_answer.rb +2 -2
- data/lib/telegram/bot/types/poll_option.rb +2 -2
- data/lib/telegram/bot/types/pre_checkout_query.rb +6 -6
- data/lib/telegram/bot/types/proximity_alert_triggered.rb +1 -1
- data/lib/telegram/bot/types/reply_keyboard_markup.rb +5 -5
- data/lib/telegram/bot/types/reply_keyboard_remove.rb +2 -2
- data/lib/telegram/bot/types/sent_web_app_message.rb +1 -1
- data/lib/telegram/bot/types/shipping_address.rb +6 -6
- data/lib/telegram/bot/types/shipping_option.rb +3 -3
- data/lib/telegram/bot/types/shipping_query.rb +2 -2
- data/lib/telegram/bot/types/sticker.rb +14 -14
- data/lib/telegram/bot/types/sticker_set.rb +7 -8
- data/lib/telegram/bot/types/successful_payment.rb +7 -7
- data/lib/telegram/bot/types/update.rb +15 -15
- data/lib/telegram/bot/types/user.rb +11 -11
- data/lib/telegram/bot/types/user_profile_photos.rb +2 -2
- data/lib/telegram/bot/types/venue.rb +6 -6
- data/lib/telegram/bot/types/video.rb +9 -9
- data/lib/telegram/bot/types/video_chat_ended.rb +1 -1
- data/lib/telegram/bot/types/video_chat_participants_invited.rb +1 -1
- data/lib/telegram/bot/types/video_chat_scheduled.rb +1 -1
- data/lib/telegram/bot/types/video_note.rb +6 -6
- data/lib/telegram/bot/types/voice.rb +5 -5
- data/lib/telegram/bot/types/web_app_data.rb +2 -2
- data/lib/telegram/bot/types/web_app_info.rb +1 -1
- data/lib/telegram/bot/types/webhook_info.rb +9 -9
- data/lib/telegram/bot/types.rb +7 -124
- data/lib/telegram/bot/version.rb +1 -1
- data/lib/telegram/bot.rb +7 -9
- data/telegram-bot-ruby.gemspec +4 -2
- metadata +51 -13
- data/lib/telegram/bot/exceptions.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6149f85b75abd46b546aac32fbe88da43e4a414bcaabb6ea05d213681d136460
|
4
|
+
data.tar.gz: 88ae56d90f1e50883034d5433d3636f2feddc2ec31826466de31e23d61e2edfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c44671c55c2dcc30b15aef63d02351775a69ae2e73ed738e74ea97c469217b17f4e0581e5300dc4280b1dda36ce1ed4d2191ee9d824491935aaa09f1e1fcefbf
|
7
|
+
data.tar.gz: e7c37c40f7f2dc9d86618a18b8e17e91a75f03632c60a8e075b78ce890d7c093501f3a4366b583b9cd3b85715bd06468cedc1472f5a153565ca132e5c97fe8d1
|
data/.env.sample
ADDED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -18,13 +18,13 @@ gem 'telegram-bot-ruby'
|
|
18
18
|
And then execute:
|
19
19
|
|
20
20
|
```shell
|
21
|
-
|
21
|
+
bundle
|
22
22
|
```
|
23
23
|
|
24
24
|
Or install it system-wide:
|
25
25
|
|
26
26
|
```shell
|
27
|
-
|
27
|
+
gem install telegram-bot-ruby
|
28
28
|
```
|
29
29
|
|
30
30
|
## Usage
|
@@ -50,8 +50,13 @@ end
|
|
50
50
|
|
51
51
|
Note that `bot.api` object implements [Telegram Bot API methods](https://core.telegram.org/bots/api#available-methods) as is. So you can invoke any method inside the block without any problems. All methods are available in both *snake_case* and *camelCase* notations.
|
52
52
|
|
53
|
-
If you need to start a bot
|
54
|
-
|
53
|
+
If you need to start a bot in development mode you have to pass `environment: :test`:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
Telegram::Bot::Client.run(token, environment: :test) do |bot|
|
57
|
+
# ...
|
58
|
+
end
|
59
|
+
```
|
55
60
|
|
56
61
|
Same thing about `message` object - it implements [Message](https://core.telegram.org/bots/api#message) spec, so you always know what to expect from it.
|
57
62
|
|
@@ -80,8 +85,13 @@ bot.listen do |message|
|
|
80
85
|
question = 'London is a capital of which country?'
|
81
86
|
# See more: https://core.telegram.org/bots/api#replykeyboardmarkup
|
82
87
|
answers =
|
83
|
-
|
84
|
-
|
88
|
+
Telegram::Bot::Types::ReplyKeyboardMarkup.new(
|
89
|
+
keyboard: [
|
90
|
+
[{ text: 'A' }, { text: 'B' }],
|
91
|
+
[{ text: 'C' }, { text: 'D' }]
|
92
|
+
],
|
93
|
+
one_time_keyboard: true
|
94
|
+
)
|
85
95
|
bot.api.send_message(chat_id: message.chat.id, text: question, reply_markup: answers)
|
86
96
|
when '/stop'
|
87
97
|
# See more: https://core.telegram.org/bots/api#replykeyboardremove
|
@@ -95,10 +105,10 @@ Furthermore, you can ask user to share location or phone number using `KeyboardB
|
|
95
105
|
|
96
106
|
```ruby
|
97
107
|
bot.listen do |message|
|
98
|
-
kb = [
|
108
|
+
kb = [[
|
99
109
|
Telegram::Bot::Types::KeyboardButton.new(text: 'Give me your phone number', request_contact: true),
|
100
110
|
Telegram::Bot::Types::KeyboardButton.new(text: 'Show me your location', request_location: true)
|
101
|
-
]
|
111
|
+
]]
|
102
112
|
markup = Telegram::Bot::Types::ReplyKeyboardMarkup.new(keyboard: kb)
|
103
113
|
bot.api.send_message(chat_id: message.chat.id, text: 'Hey!', reply_markup: markup)
|
104
114
|
end
|
@@ -117,11 +127,11 @@ bot.listen do |message|
|
|
117
127
|
bot.api.send_message(chat_id: message.from.id, text: "Don't touch me!")
|
118
128
|
end
|
119
129
|
when Telegram::Bot::Types::Message
|
120
|
-
kb = [
|
130
|
+
kb = [[
|
121
131
|
Telegram::Bot::Types::InlineKeyboardButton.new(text: 'Go to Google', url: 'https://google.com'),
|
122
132
|
Telegram::Bot::Types::InlineKeyboardButton.new(text: 'Touch me', callback_data: 'touch'),
|
123
133
|
Telegram::Bot::Types::InlineKeyboardButton.new(text: 'Switch to inline', switch_inline_query: 'some text')
|
124
|
-
]
|
134
|
+
]]
|
125
135
|
markup = Telegram::Bot::Types::InlineKeyboardMarkup.new(inline_keyboard: kb)
|
126
136
|
bot.api.send_message(chat_id: message.chat.id, text: 'Make a choice', reply_markup: markup)
|
127
137
|
end
|
@@ -137,8 +147,8 @@ bot.listen do |message|
|
|
137
147
|
case message
|
138
148
|
when Telegram::Bot::Types::InlineQuery
|
139
149
|
results = [
|
140
|
-
[1, 'First article', 'Very interesting text goes here.'],
|
141
|
-
[2, 'Second article', 'Another interesting text here.']
|
150
|
+
['1', 'First article', 'Very interesting text goes here.'],
|
151
|
+
['2', 'Second article', 'Another interesting text here.']
|
142
152
|
].map do |arr|
|
143
153
|
Telegram::Bot::Types::InlineQueryResultArticle.new(
|
144
154
|
id: arr[0],
|
@@ -166,7 +176,8 @@ Your bot can even upload files ([photos](https://core.telegram.org/bots/api#send
|
|
166
176
|
bot.listen do |message|
|
167
177
|
case message.text
|
168
178
|
when '/photo'
|
169
|
-
|
179
|
+
path_to_photo = File.expand_path('~/Desktop/jennifer.jpg')
|
180
|
+
bot.api.send_photo(chat_id: message.chat.id, photo: Faraday::UploadIO.new(path_to_photo, 'image/jpeg'))
|
170
181
|
end
|
171
182
|
end
|
172
183
|
```
|
@@ -199,6 +210,7 @@ end
|
|
199
210
|
## Boilerplates
|
200
211
|
|
201
212
|
If you don't know how to setup database for your bot or how to use it with different languages here are some boilerplates which can help you to start faster:
|
213
|
+
|
202
214
|
- [Ruby Telegram Bot boilerplate](https://github.com/telegram-bots/ruby-telegram-bot-boilerplate)
|
203
215
|
|
204
216
|
## Contributing
|
data/Rakefile
CHANGED
@@ -15,3 +15,46 @@ end
|
|
15
15
|
RSpec::Core::RakeTask.new(:spec)
|
16
16
|
|
17
17
|
task default: :spec
|
18
|
+
|
19
|
+
desc 'Dump type definitions from docs to YAML'
|
20
|
+
task :dump_type_attributes do
|
21
|
+
require File.expand_path('lib/telegram/bot', __dir__)
|
22
|
+
require 'nokogiri'
|
23
|
+
require 'open-uri'
|
24
|
+
require 'yaml'
|
25
|
+
|
26
|
+
# Preload every type we have
|
27
|
+
Zeitwerk::Loader.eager_load_all
|
28
|
+
types = Telegram::Bot::Types::Base.descendants.map { |c| c.name.split('::').last }
|
29
|
+
|
30
|
+
# Fetch and parse docs
|
31
|
+
doc = Nokogiri::HTML(URI.open('https://core.telegram.org/bots/api').read)
|
32
|
+
|
33
|
+
result = types.to_h do |type|
|
34
|
+
# This is very hacky but working way to find table containing attributes for
|
35
|
+
# given type. Basic idea is to find heading with type and then iterate until
|
36
|
+
# we find table with attributes or next heading (because sometimes type
|
37
|
+
# doesn't have any attributes).
|
38
|
+
element = doc.at_xpath(%{//h4[text() = "#{type}"]})
|
39
|
+
loop do
|
40
|
+
element = element.next_element
|
41
|
+
break if %w[table h4].include?(element.name)
|
42
|
+
end
|
43
|
+
|
44
|
+
attributes = element.xpath('.//tbody//tr').map do |el|
|
45
|
+
cells = el.children.select { |c| c.name == 'td' }
|
46
|
+
{
|
47
|
+
'name' => cells[0].text,
|
48
|
+
'required' => !cells[2].text.start_with?('Optional.')
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
[type, attributes]
|
53
|
+
end
|
54
|
+
|
55
|
+
# Write everything to fixture file
|
56
|
+
File.write(
|
57
|
+
File.expand_path('spec/fixtures/type_attributes.yml', __dir__),
|
58
|
+
result.to_yaml
|
59
|
+
)
|
60
|
+
end
|
@@ -4,15 +4,15 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class Animation < Base
|
7
|
-
attribute :file_id, String
|
8
|
-
attribute :file_unique_id, String
|
9
|
-
attribute :width, Integer
|
10
|
-
attribute :height, Integer
|
11
|
-
attribute :duration, Integer
|
12
|
-
attribute :thumb, PhotoSize
|
13
|
-
attribute :file_name, String
|
14
|
-
attribute :mime_type, String
|
15
|
-
attribute :file_size, Integer
|
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 :duration, Types::Integer
|
12
|
+
attribute? :thumb, PhotoSize
|
13
|
+
attribute? :file_name, Types::String
|
14
|
+
attribute? :mime_type, Types::String
|
15
|
+
attribute? :file_size, Types::Integer
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -4,15 +4,15 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class Audio < Base
|
7
|
-
attribute :file_id, String
|
8
|
-
attribute :file_unique_id, String
|
9
|
-
attribute :duration, Integer
|
10
|
-
attribute :performer, String
|
11
|
-
attribute :title, String
|
12
|
-
attribute :file_name, String
|
13
|
-
attribute :mime_type, String
|
14
|
-
attribute :file_size, Integer
|
15
|
-
attribute :thumb, PhotoSize
|
7
|
+
attribute :file_id, Types::String
|
8
|
+
attribute :file_unique_id, Types::String
|
9
|
+
attribute :duration, Types::Integer
|
10
|
+
attribute? :performer, Types::String
|
11
|
+
attribute? :title, Types::String
|
12
|
+
attribute? :file_name, Types::String
|
13
|
+
attribute? :mime_type, Types::String
|
14
|
+
attribute? :file_size, Types::Integer
|
15
|
+
attribute? :thumb, PhotoSize
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -4,8 +4,8 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class BotCommandScopeChatAdministrators < Base
|
7
|
-
attribute :type, String
|
8
|
-
attribute :chat_id, String
|
7
|
+
attribute :type, Types::String.default('chat_administrators')
|
8
|
+
attribute :chat_id, Types::String
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -4,9 +4,9 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class BotCommandScopeChatMember < Base
|
7
|
-
attribute :type, String
|
8
|
-
attribute :chat_id, String
|
9
|
-
attribute :user_id, Integer
|
7
|
+
attribute :type, Types::String.default('chat_member')
|
8
|
+
attribute :chat_id, Types::String
|
9
|
+
attribute :user_id, Types::Integer
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -4,13 +4,13 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class CallbackQuery < Base
|
7
|
-
attribute :id, String
|
7
|
+
attribute :id, Types::String
|
8
8
|
attribute :from, User
|
9
|
-
attribute :message, Message
|
10
|
-
attribute :inline_message_id, String
|
11
|
-
attribute :chat_instance, String
|
12
|
-
attribute :data, String
|
13
|
-
attribute :game_short_name, String
|
9
|
+
attribute? :message, Message
|
10
|
+
attribute? :inline_message_id, Types::String
|
11
|
+
attribute :chat_instance, Types::String
|
12
|
+
attribute? :data, Types::String
|
13
|
+
attribute? :game_short_name, Types::String
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -3,34 +3,33 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
class Chat
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
attribute :
|
12
|
-
attribute :
|
13
|
-
attribute :
|
14
|
-
attribute :
|
15
|
-
attribute :
|
16
|
-
attribute :
|
17
|
-
attribute :
|
18
|
-
attribute :
|
19
|
-
attribute :
|
20
|
-
attribute :
|
21
|
-
attribute :
|
22
|
-
attribute :
|
23
|
-
attribute :
|
24
|
-
attribute :
|
25
|
-
attribute :
|
26
|
-
attribute :
|
27
|
-
attribute :
|
28
|
-
attribute :
|
29
|
-
attribute :
|
30
|
-
attribute :
|
31
|
-
attribute :
|
32
|
-
attribute :
|
33
|
-
attribute :location, ChatLocation
|
6
|
+
class Chat < Base
|
7
|
+
attribute :id, Types::Integer
|
8
|
+
attribute :type, Types::String
|
9
|
+
attribute? :title, Types::String
|
10
|
+
attribute? :username, Types::String
|
11
|
+
attribute? :first_name, Types::String
|
12
|
+
attribute? :last_name, Types::String
|
13
|
+
attribute? :is_forum, Types::Bool
|
14
|
+
attribute? :photo, ChatPhoto
|
15
|
+
attribute? :active_usernames, Types::Array.of(Types::String)
|
16
|
+
attribute? :emoji_status_custom_emoji_id, Types::String
|
17
|
+
attribute? :bio, Types::String
|
18
|
+
attribute? :has_private_forwards, Types::Bool
|
19
|
+
attribute? :has_restricted_voice_and_video_messages, Types::Bool
|
20
|
+
attribute? :join_to_send_messages, Types::Bool
|
21
|
+
attribute? :join_by_request, Types::Bool
|
22
|
+
attribute? :description, Types::String
|
23
|
+
attribute? :invite_link, Types::String
|
24
|
+
attribute? :pinned_message, Message
|
25
|
+
attribute? :permissions, ChatPermissions
|
26
|
+
attribute? :slow_mode_delay, Types::Integer
|
27
|
+
attribute? :message_auto_delete_time, Types::Integer
|
28
|
+
attribute? :has_protected_content, Types::Bool
|
29
|
+
attribute? :sticker_set_name, Types::String
|
30
|
+
attribute? :can_set_sticker_set, Types::Bool
|
31
|
+
attribute? :linked_chat_id, Types::Integer
|
32
|
+
attribute? :location, ChatLocation
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
@@ -3,18 +3,19 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
class
|
7
|
-
attribute :is_anonymous,
|
8
|
-
attribute :can_manage_chat,
|
9
|
-
attribute :can_delete_messages,
|
10
|
-
attribute :can_manage_video_chats,
|
11
|
-
attribute :can_restrict_members,
|
12
|
-
attribute :can_promote_members,
|
13
|
-
attribute :can_change_info,
|
14
|
-
attribute :can_invite_users,
|
15
|
-
attribute :can_post_messages,
|
16
|
-
attribute :can_edit_messages,
|
17
|
-
attribute :can_pin_messages,
|
6
|
+
class ChatAdministratorRights < Base
|
7
|
+
attribute :is_anonymous, Types::Bool
|
8
|
+
attribute :can_manage_chat, Types::Bool
|
9
|
+
attribute :can_delete_messages, Types::Bool
|
10
|
+
attribute :can_manage_video_chats, Types::Bool
|
11
|
+
attribute :can_restrict_members, Types::Bool
|
12
|
+
attribute :can_promote_members, Types::Bool
|
13
|
+
attribute :can_change_info, Types::Bool
|
14
|
+
attribute :can_invite_users, Types::Bool
|
15
|
+
attribute? :can_post_messages, Types::Bool
|
16
|
+
attribute? :can_edit_messages, Types::Bool
|
17
|
+
attribute? :can_pin_messages, Types::Bool
|
18
|
+
attribute? :can_manage_topics, Types::Bool
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -4,15 +4,15 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class ChatInviteLink < Base
|
7
|
-
attribute :invite_link, String
|
7
|
+
attribute :invite_link, Types::String
|
8
8
|
attribute :creator, User
|
9
|
-
attribute :creates_join_request,
|
10
|
-
attribute :is_primary,
|
11
|
-
attribute :is_revoked,
|
12
|
-
attribute :name, String
|
13
|
-
attribute :expire_date, Integer
|
14
|
-
attribute :member_limit, Integer
|
15
|
-
attribute :pending_join_request_count, Integer
|
9
|
+
attribute :creates_join_request, Types::Bool
|
10
|
+
attribute :is_primary, Types::Bool
|
11
|
+
attribute :is_revoked, Types::Bool
|
12
|
+
attribute? :name, Types::String
|
13
|
+
attribute? :expire_date, Types::Integer
|
14
|
+
attribute? :member_limit, Types::Integer
|
15
|
+
attribute? :pending_join_request_count, Types::Integer
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -6,9 +6,9 @@ module Telegram
|
|
6
6
|
class ChatJoinRequest < Base
|
7
7
|
attribute :chat, Chat
|
8
8
|
attribute :from, User
|
9
|
-
attribute :date, Integer
|
10
|
-
attribute :bio, String
|
11
|
-
attribute :invite_link, ChatInviteLink
|
9
|
+
attribute :date, Types::Integer
|
10
|
+
attribute? :bio, Types::String
|
11
|
+
attribute? :invite_link, ChatInviteLink
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -4,28 +4,6 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class ChatMember < Base
|
7
|
-
attribute :user, User
|
8
|
-
attribute :status, String
|
9
|
-
attribute :custom_title, String
|
10
|
-
attribute :is_anonymous, Boolean
|
11
|
-
attribute :can_be_edited, Boolean
|
12
|
-
attribute :can_manage_chat, Boolean
|
13
|
-
attribute :can_post_messages, Boolean
|
14
|
-
attribute :can_edit_messages, Boolean
|
15
|
-
attribute :can_delete_messages, Boolean
|
16
|
-
attribute :can_manage_video_chats, Boolean
|
17
|
-
attribute :can_restrict_members, Boolean
|
18
|
-
attribute :can_promote_members, Boolean
|
19
|
-
attribute :can_change_info, Boolean
|
20
|
-
attribute :can_invite_users, Boolean
|
21
|
-
attribute :can_pin_messages, Boolean
|
22
|
-
attribute :is_member, Boolean
|
23
|
-
attribute :can_send_messages, Boolean
|
24
|
-
attribute :can_send_media_messages, Boolean
|
25
|
-
attribute :can_send_polls, Boolean
|
26
|
-
attribute :can_send_other_messages, Boolean
|
27
|
-
attribute :can_add_web_page_previews, Boolean
|
28
|
-
attribute :until_date, Integer
|
29
7
|
end
|
30
8
|
end
|
31
9
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class ChatMemberAdministrator < ChatMember
|
7
|
+
attribute :status, Types::String
|
8
|
+
attribute :user, User
|
9
|
+
attribute :can_be_edited, Types::Bool
|
10
|
+
attribute :is_anonymous, Types::Bool
|
11
|
+
attribute :can_manage_chat, Types::Bool
|
12
|
+
attribute :can_delete_messages, Types::Bool
|
13
|
+
attribute :can_manage_video_chats, Types::Bool
|
14
|
+
attribute :can_restrict_members, Types::Bool
|
15
|
+
attribute :can_promote_members, Types::Bool
|
16
|
+
attribute :can_change_info, Types::Bool
|
17
|
+
attribute :can_invite_users, Types::Bool
|
18
|
+
attribute? :can_post_messages, Types::Bool
|
19
|
+
attribute? :can_edit_messages, Types::Integer
|
20
|
+
attribute? :can_pin_messages, Types::Integer
|
21
|
+
attribute? :can_manage_topics, Types::Integer
|
22
|
+
attribute? :custom_title, Types::String
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class ChatMemberOwner < ChatMember
|
7
|
+
attribute :status, Types::String
|
8
|
+
attribute :user, User
|
9
|
+
attribute :is_anonymous, Types::Bool
|
10
|
+
attribute? :custom_title, Types::String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class ChatMemberRestricted < ChatMember
|
7
|
+
attribute :status, Types::String
|
8
|
+
attribute :user, User
|
9
|
+
attribute :is_member, Types::Bool
|
10
|
+
attribute :can_change_info, Types::Bool
|
11
|
+
attribute :can_invite_users, Types::Bool
|
12
|
+
attribute :can_pin_messages, Types::Bool
|
13
|
+
attribute :can_manage_topics, Types::Bool
|
14
|
+
attribute :can_send_messages, Types::Bool
|
15
|
+
attribute :can_send_media_messages, Types::Bool
|
16
|
+
attribute :can_send_polls, Types::Bool
|
17
|
+
attribute :can_send_other_messages, Types::Bool
|
18
|
+
attribute :can_add_web_page_previews, Types::Bool
|
19
|
+
attribute :until_date, Types::Integer
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|