telegram-bot-ruby 0.9.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +22 -0
- data/lib/telegram/bot/api.rb +3 -1
- data/lib/telegram/bot/client.rb +2 -2
- data/lib/telegram/bot/types.rb +19 -14
- data/lib/telegram/bot/types/animation.rb +4 -0
- data/lib/telegram/bot/types/audio.rb +1 -0
- data/lib/telegram/bot/types/chat.rb +4 -0
- data/lib/telegram/bot/types/chat_member.rb +5 -3
- data/lib/telegram/bot/types/chat_permissions.rb +16 -0
- data/lib/telegram/bot/types/chat_photo.rb +2 -0
- data/lib/telegram/bot/types/dice.rb +10 -0
- data/lib/telegram/bot/types/document.rb +1 -0
- data/lib/telegram/bot/types/file.rb +1 -0
- data/lib/telegram/bot/types/inline_keyboard_button.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_gif.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +1 -0
- data/lib/telegram/bot/types/keyboard_button.rb +1 -0
- data/lib/telegram/bot/types/keyboard_button_poll_type.rb +9 -0
- data/lib/telegram/bot/types/login_url.rb +12 -0
- data/lib/telegram/bot/types/message.rb +4 -0
- data/lib/telegram/bot/types/message_entity.rb +1 -0
- data/lib/telegram/bot/types/passport_file.rb +1 -0
- data/lib/telegram/bot/types/photo_size.rb +1 -0
- data/lib/telegram/bot/types/poll.rb +9 -0
- data/lib/telegram/bot/types/poll_answer.rb +11 -0
- data/lib/telegram/bot/types/sticker.rb +2 -0
- data/lib/telegram/bot/types/sticker_set.rb +2 -0
- data/lib/telegram/bot/types/update.rb +1 -0
- data/lib/telegram/bot/types/user.rb +3 -0
- data/lib/telegram/bot/types/video.rb +1 -0
- data/lib/telegram/bot/types/video_note.rb +1 -0
- data/lib/telegram/bot/types/voice.rb +1 -0
- data/lib/telegram/bot/version.rb +1 -1
- data/telegram-bot-ruby.gemspec +1 -1
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2649b3b518f533f21f76f5b9002859193931492b3828cbbcd483001cecc80917
|
4
|
+
data.tar.gz: c8266c61deba86552d0bd93062cf6a04bb0e7e4a505d6e6a076de7ec8433cf2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9810e2b705be56be45b1ab731a544f7a242b446ec335429b358b48de4c8d552df7dfe508f62b8d7fe3c3ae7a8a9f2bf8e16bc87c9f2ea4ecdbe36e7c9b167921
|
7
|
+
data.tar.gz: 887d8c8a64ccb52b079ba6ece9f6f060616d45fc4793b4c114310556a201c50e77ecb3ba5c3ee55dcf9635d21630b7e5819b70927ab9fd371ddf3d0a85fbed48
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.13.0
|
4
|
+
|
5
|
+
- Implement [Bot API 4.9](https://core.telegram.org/bots/api-changelog#june-4-2020)
|
6
|
+
- Implement [Bot API 4.8](https://core.telegram.org/bots/api-changelog#april-24-2020)
|
7
|
+
- Implement [Bot API 4.7](https://core.telegram.org/bots/api-changelog#march-30-2020)
|
8
|
+
|
9
|
+
## 0.12.0
|
10
|
+
|
11
|
+
- Implement [Bot API 4.5](https://core.telegram.org/bots/api-changelog#december-31-2019) and [Bot API 4.6](https://core.telegram.org/bots/api-changelog#january-23-2020)
|
12
|
+
|
13
|
+
## 0.11.0
|
14
|
+
|
15
|
+
- Implement [Bot API 4.4](https://core.telegram.org/bots/api#july-29-2019)
|
16
|
+
|
17
|
+
## 0.10.1
|
18
|
+
|
19
|
+
- Fix issue #202 with `Poll` messages and logging
|
20
|
+
|
21
|
+
## 0.10.0
|
22
|
+
|
23
|
+
- Implement [Bot API 4.3](https://core.telegram.org/bots/api#may-31-2019)
|
24
|
+
|
3
25
|
## 0.9.1
|
4
26
|
|
5
27
|
- Allow to configure API URL (thx [@markfrst][])
|
data/lib/telegram/bot/api.rb
CHANGED
@@ -17,7 +17,9 @@ module Telegram
|
|
17
17
|
setStickerPositionInSet deleteStickerFromSet answerInlineQuery
|
18
18
|
sendInvoice answerShippingQuery answerPreCheckoutQuery
|
19
19
|
sendGame setGameScore getGameHighScores setPassportDataErrors
|
20
|
-
editMessageMedia sendAnimation sendPoll stopPoll
|
20
|
+
editMessageMedia sendAnimation sendPoll stopPoll setChatPermissions
|
21
|
+
setChatAdministratorCustomTitle sendDice getMyCommands setMyCommands
|
22
|
+
setStickerSetThumb
|
21
23
|
).freeze
|
22
24
|
REPLY_MARKUP_TYPES = [
|
23
25
|
Telegram::Bot::Types::ReplyKeyboardMarkup,
|
data/lib/telegram/bot/client.rb
CHANGED
@@ -37,7 +37,7 @@ module Telegram
|
|
37
37
|
log_incoming_message(message)
|
38
38
|
yield message
|
39
39
|
end
|
40
|
-
rescue Faraday::
|
40
|
+
rescue Faraday::TimeoutError
|
41
41
|
retry
|
42
42
|
end
|
43
43
|
|
@@ -53,7 +53,7 @@ module Telegram
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def log_incoming_message(message)
|
56
|
-
uid = message.from ? message.from.id : nil
|
56
|
+
uid = message.respond_to?(:from) && message.from ? message.from.id : nil
|
57
57
|
logger.info(
|
58
58
|
format('Incoming message: text="%s" uid=%s', message, uid)
|
59
59
|
)
|
data/lib/telegram/bot/types.rb
CHANGED
@@ -11,8 +11,10 @@ require 'telegram/bot/types/video'
|
|
11
11
|
require 'telegram/bot/types/voice'
|
12
12
|
require 'telegram/bot/types/video_note'
|
13
13
|
require 'telegram/bot/types/contact'
|
14
|
+
require 'telegram/bot/types/dice'
|
14
15
|
require 'telegram/bot/types/location'
|
15
16
|
require 'telegram/bot/types/chat_photo'
|
17
|
+
require 'telegram/bot/types/chat_permissions'
|
16
18
|
require 'telegram/bot/types/chat'
|
17
19
|
require 'telegram/bot/types/message_entity'
|
18
20
|
require 'telegram/bot/types/venue'
|
@@ -25,13 +27,27 @@ require 'telegram/bot/types/shipping_address'
|
|
25
27
|
require 'telegram/bot/types/order_info'
|
26
28
|
require 'telegram/bot/types/successful_payment'
|
27
29
|
require 'telegram/bot/types/poll_option'
|
30
|
+
require 'telegram/bot/types/poll_answer'
|
28
31
|
require 'telegram/bot/types/poll'
|
29
|
-
require 'telegram/bot/types/
|
32
|
+
require 'telegram/bot/types/passport_file'
|
33
|
+
require 'telegram/bot/types/encrypted_passport_element'
|
34
|
+
require 'telegram/bot/types/encrypted_credentials'
|
35
|
+
require 'telegram/bot/types/passport_data'
|
36
|
+
require 'telegram/bot/types/passport_element_error_data_field'
|
37
|
+
require 'telegram/bot/types/passport_element_error_front_side'
|
38
|
+
require 'telegram/bot/types/passport_element_error_reverse_side'
|
39
|
+
require 'telegram/bot/types/passport_element_error_selfie'
|
40
|
+
require 'telegram/bot/types/passport_element_error_file'
|
41
|
+
require 'telegram/bot/types/passport_element_error_files'
|
42
|
+
require 'telegram/bot/types/passport_element_error_translation_file'
|
43
|
+
require 'telegram/bot/types/passport_element_error_translation_files'
|
44
|
+
require 'telegram/bot/types/passport_element_error_unspecified'
|
30
45
|
require 'telegram/bot/types/input_message_content'
|
31
46
|
require 'telegram/bot/types/input_contact_message_content'
|
32
47
|
require 'telegram/bot/types/input_location_message_content'
|
33
48
|
require 'telegram/bot/types/input_text_message_content'
|
34
49
|
require 'telegram/bot/types/input_venue_message_content'
|
50
|
+
require 'telegram/bot/types/login_url'
|
35
51
|
require 'telegram/bot/types/inline_keyboard_button'
|
36
52
|
require 'telegram/bot/types/inline_keyboard_markup'
|
37
53
|
require 'telegram/bot/types/inline_query'
|
@@ -56,10 +72,12 @@ require 'telegram/bot/types/inline_query_result_venue'
|
|
56
72
|
require 'telegram/bot/types/inline_query_result_video'
|
57
73
|
require 'telegram/bot/types/inline_query_result_voice'
|
58
74
|
require 'telegram/bot/types/chosen_inline_result'
|
75
|
+
require 'telegram/bot/types/message'
|
59
76
|
require 'telegram/bot/types/callback_query'
|
60
77
|
require 'telegram/bot/types/shipping_query'
|
61
78
|
require 'telegram/bot/types/pre_checkout_query'
|
62
79
|
require 'telegram/bot/types/update'
|
80
|
+
require 'telegram/bot/types/keyboard_button_poll_type'
|
63
81
|
require 'telegram/bot/types/keyboard_button'
|
64
82
|
require 'telegram/bot/types/reply_keyboard_markup'
|
65
83
|
require 'telegram/bot/types/reply_keyboard_remove'
|
@@ -71,19 +89,6 @@ require 'telegram/bot/types/chat_member'
|
|
71
89
|
require 'telegram/bot/types/user_profile_photos'
|
72
90
|
require 'telegram/bot/types/input_media_photo'
|
73
91
|
require 'telegram/bot/types/input_media_video'
|
74
|
-
require 'telegram/bot/types/passport_file'
|
75
|
-
require 'telegram/bot/types/encrypted_passport_element'
|
76
|
-
require 'telegram/bot/types/encrypted_credentials'
|
77
|
-
require 'telegram/bot/types/passport_data'
|
78
|
-
require 'telegram/bot/types/passport_element_error_data_field'
|
79
|
-
require 'telegram/bot/types/passport_element_error_front_side'
|
80
|
-
require 'telegram/bot/types/passport_element_error_reverse_side'
|
81
|
-
require 'telegram/bot/types/passport_element_error_selfie'
|
82
|
-
require 'telegram/bot/types/passport_element_error_file'
|
83
|
-
require 'telegram/bot/types/passport_element_error_files'
|
84
|
-
require 'telegram/bot/types/passport_element_error_translation_file'
|
85
|
-
require 'telegram/bot/types/passport_element_error_translation_files'
|
86
|
-
require 'telegram/bot/types/passport_element_error_unspecified'
|
87
92
|
require 'telegram/bot/types/input_media_animation'
|
88
93
|
require 'telegram/bot/types/input_media_audio'
|
89
94
|
require 'telegram/bot/types/input_media_document'
|
@@ -3,6 +3,10 @@ module Telegram
|
|
3
3
|
module Types
|
4
4
|
class Animation < Base
|
5
5
|
attribute :file_id, String
|
6
|
+
attribute :file_unique_id, String
|
7
|
+
attribute :width, Integer
|
8
|
+
attribute :height, Integer
|
9
|
+
attribute :duration, Integer
|
6
10
|
attribute :thumb, PhotoSize
|
7
11
|
attribute :file_name, String
|
8
12
|
attribute :mime_type, String
|
@@ -16,6 +16,10 @@ module Telegram
|
|
16
16
|
attribute :description, String
|
17
17
|
attribute :invite_link, String
|
18
18
|
attribute :pinned_message, 'Telegram::Bot::Types::Message'
|
19
|
+
attribute :permissions, ChatPermissions
|
20
|
+
attribute :slow_mode_delay, Integer
|
21
|
+
attribute :sticker_set_name, String
|
22
|
+
attribute :can_set_sticker_set, Boolean
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -4,19 +4,21 @@ module Telegram
|
|
4
4
|
class ChatMember < Base
|
5
5
|
attribute :user, User
|
6
6
|
attribute :status, String
|
7
|
+
attribute :custom_title, String
|
7
8
|
attribute :until_date, Integer
|
8
9
|
attribute :can_be_edited, Boolean
|
9
|
-
attribute :can_change_info, Boolean
|
10
10
|
attribute :can_post_messages, Boolean
|
11
11
|
attribute :can_edit_messages, Boolean
|
12
12
|
attribute :can_delete_messages, Boolean
|
13
|
-
attribute :can_invite_users, Boolean
|
14
13
|
attribute :can_restrict_members, Boolean
|
15
|
-
attribute :can_pin_messages, Boolean
|
16
14
|
attribute :can_promote_members, Boolean
|
15
|
+
attribute :can_change_info, Boolean
|
16
|
+
attribute :can_invite_users, Boolean
|
17
|
+
attribute :can_pin_messages, Boolean
|
17
18
|
attribute :is_member, Boolean
|
18
19
|
attribute :can_send_messages, Boolean
|
19
20
|
attribute :can_send_media_messages, Boolean
|
21
|
+
attribute :can_send_polls, Boolean
|
20
22
|
attribute :can_send_other_messages, Boolean
|
21
23
|
attribute :can_add_web_page_previews, Boolean
|
22
24
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class ChatPermissions < Base
|
5
|
+
attribute :can_send_messages, Boolean
|
6
|
+
attribute :can_send_media_messages, Boolean
|
7
|
+
attribute :can_send_polls, Boolean
|
8
|
+
attribute :can_send_other_messages, Boolean
|
9
|
+
attribute :can_add_web_page_previews, Boolean
|
10
|
+
attribute :can_change_info, Boolean
|
11
|
+
attribute :can_invite_users, Boolean
|
12
|
+
attribute :can_pin_messages, Boolean
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -9,6 +9,7 @@ module Telegram
|
|
9
9
|
attribute :mpeg4_height, Integer
|
10
10
|
attribute :mpeg4_duration, Integer
|
11
11
|
attribute :thumb_url, String
|
12
|
+
attribute :thumb_mime_type, String
|
12
13
|
attribute :title, String
|
13
14
|
attribute :caption, String
|
14
15
|
attribute :reply_markup, InlineKeyboardMarkup
|
@@ -13,6 +13,7 @@ module Telegram
|
|
13
13
|
attribute :forward_sender_name, String
|
14
14
|
attribute :forward_date, Integer
|
15
15
|
attribute :reply_to_message, Message
|
16
|
+
attribute :via_bot, User
|
16
17
|
attribute :edit_date, Integer
|
17
18
|
attribute :media_group_id, String
|
18
19
|
attribute :author_signature, String
|
@@ -30,6 +31,7 @@ module Telegram
|
|
30
31
|
attribute :video_note, VideoNote
|
31
32
|
attribute :caption, String
|
32
33
|
attribute :contact, Contact
|
34
|
+
attribute :dice, Dice
|
33
35
|
attribute :location, Location
|
34
36
|
attribute :venue, Venue
|
35
37
|
attribute :poll, Poll
|
@@ -47,6 +49,8 @@ module Telegram
|
|
47
49
|
attribute :invoice, Invoice
|
48
50
|
attribute :successful_payment, SuccessfulPayment
|
49
51
|
attribute :connected_website, String
|
52
|
+
attribute :passport_data, PassportData
|
53
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
50
54
|
|
51
55
|
alias to_s text
|
52
56
|
end
|
@@ -5,7 +5,16 @@ module Telegram
|
|
5
5
|
attribute :id, String
|
6
6
|
attribute :question, String
|
7
7
|
attribute :options, Array[PollOption]
|
8
|
+
attribute :total_voter_count, Integer
|
8
9
|
attribute :is_closed, Boolean
|
10
|
+
attribute :is_anonymous, Boolean
|
11
|
+
attribute :type, String
|
12
|
+
attribute :allows_multiple_answers, Boolean
|
13
|
+
attribute :correct_option_id, Integer
|
14
|
+
attribute :explanation, String
|
15
|
+
attribute :explanation_entities, Array[MessageEntity]
|
16
|
+
attribute :open_period, Integer
|
17
|
+
attribute :close_date, Integer
|
9
18
|
end
|
10
19
|
end
|
11
20
|
end
|
@@ -3,8 +3,10 @@ module Telegram
|
|
3
3
|
module Types
|
4
4
|
class Sticker < Base
|
5
5
|
attribute :file_id, String
|
6
|
+
attribute :file_unique_id, String
|
6
7
|
attribute :width, Integer
|
7
8
|
attribute :height, Integer
|
9
|
+
attribute :is_animated, Boolean
|
8
10
|
attribute :thumb, PhotoSize
|
9
11
|
attribute :emoji, String
|
10
12
|
attribute :set_name, String
|
@@ -8,6 +8,9 @@ module Telegram
|
|
8
8
|
attribute :last_name, String
|
9
9
|
attribute :username, String
|
10
10
|
attribute :language_code, String
|
11
|
+
attribute :can_join_groups, Boolean
|
12
|
+
attribute :can_read_all_group_messages, Boolean
|
13
|
+
attribute :supports_inline_queries, Boolean
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
data/lib/telegram/bot/version.rb
CHANGED
data/telegram-bot-ruby.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'virtus'
|
22
22
|
spec.add_dependency 'inflecto'
|
23
23
|
|
24
|
-
spec.add_development_dependency 'rake', '~>
|
24
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
25
25
|
spec.add_development_dependency 'pry'
|
26
26
|
spec.add_development_dependency 'rubocop', '~> 0.48.1'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegram-bot-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Tipugin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,10 +158,12 @@ files:
|
|
158
158
|
- lib/telegram/bot/types/callback_query.rb
|
159
159
|
- lib/telegram/bot/types/chat.rb
|
160
160
|
- lib/telegram/bot/types/chat_member.rb
|
161
|
+
- lib/telegram/bot/types/chat_permissions.rb
|
161
162
|
- lib/telegram/bot/types/chat_photo.rb
|
162
163
|
- lib/telegram/bot/types/chosen_inline_result.rb
|
163
164
|
- lib/telegram/bot/types/compactable.rb
|
164
165
|
- lib/telegram/bot/types/contact.rb
|
166
|
+
- lib/telegram/bot/types/dice.rb
|
165
167
|
- lib/telegram/bot/types/document.rb
|
166
168
|
- lib/telegram/bot/types/encrypted_credentials.rb
|
167
169
|
- lib/telegram/bot/types/encrypted_passport_element.rb
|
@@ -204,8 +206,10 @@ files:
|
|
204
206
|
- lib/telegram/bot/types/input_venue_message_content.rb
|
205
207
|
- lib/telegram/bot/types/invoice.rb
|
206
208
|
- lib/telegram/bot/types/keyboard_button.rb
|
209
|
+
- lib/telegram/bot/types/keyboard_button_poll_type.rb
|
207
210
|
- lib/telegram/bot/types/labeled_price.rb
|
208
211
|
- lib/telegram/bot/types/location.rb
|
212
|
+
- lib/telegram/bot/types/login_url.rb
|
209
213
|
- lib/telegram/bot/types/mask_position.rb
|
210
214
|
- lib/telegram/bot/types/message.rb
|
211
215
|
- lib/telegram/bot/types/message_entity.rb
|
@@ -223,6 +227,7 @@ files:
|
|
223
227
|
- lib/telegram/bot/types/passport_file.rb
|
224
228
|
- lib/telegram/bot/types/photo_size.rb
|
225
229
|
- lib/telegram/bot/types/poll.rb
|
230
|
+
- lib/telegram/bot/types/poll_answer.rb
|
226
231
|
- lib/telegram/bot/types/poll_option.rb
|
227
232
|
- lib/telegram/bot/types/pre_checkout_query.rb
|
228
233
|
- lib/telegram/bot/types/reply_keyboard_markup.rb
|
@@ -260,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
265
|
- !ruby/object:Gem::Version
|
261
266
|
version: '0'
|
262
267
|
requirements: []
|
263
|
-
rubygems_version: 3.
|
268
|
+
rubygems_version: 3.1.2
|
264
269
|
signing_key:
|
265
270
|
specification_version: 4
|
266
271
|
summary: Ruby wrapper for Telegram's Bot API
|