telegram-bot-ruby 0.8.6.1 → 0.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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/bin/console +3 -2
- data/lib/telegram/bot/api.rb +5 -4
- data/lib/telegram/bot/types.rb +19 -1
- data/lib/telegram/bot/types/audio.rb +1 -0
- data/lib/telegram/bot/types/chat_member.rb +1 -0
- data/lib/telegram/bot/types/contact.rb +1 -0
- data/lib/telegram/bot/types/encrypted_credentials.rb +11 -0
- data/lib/telegram/bot/types/encrypted_passport_element.rb +18 -0
- data/lib/telegram/bot/types/inline_query_result_contact.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_venue.rb +1 -0
- data/lib/telegram/bot/types/input_contact_message_content.rb +1 -0
- data/lib/telegram/bot/types/input_media_animation.rb +16 -0
- data/lib/telegram/bot/types/input_media_audio.rb +16 -0
- data/lib/telegram/bot/types/input_media_document.rb +13 -0
- data/lib/telegram/bot/types/input_media_video.rb +1 -0
- data/lib/telegram/bot/types/input_venue_message_content.rb +1 -0
- data/lib/telegram/bot/types/message.rb +5 -0
- data/lib/telegram/bot/types/passport_data.rb +10 -0
- data/lib/telegram/bot/types/passport_element_error_data_field.rb +13 -0
- data/lib/telegram/bot/types/passport_element_error_file.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error_files.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error_front_side.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error_selfie.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error_translation_file.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error_translation_files.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error_unspecified.rb +12 -0
- data/lib/telegram/bot/types/passport_file.rb +11 -0
- data/lib/telegram/bot/types/poll.rb +12 -0
- data/lib/telegram/bot/types/poll_option.rb +10 -0
- data/lib/telegram/bot/types/update.rb +1 -0
- data/lib/telegram/bot/types/venue.rb +1 -0
- data/lib/telegram/bot/version.rb +1 -1
- data/telegram-bot-ruby.gemspec +0 -1
- metadata +21 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 46df3e677efb20c202616015ee9f147a8c9cb82378ddf4361cd77a982a4b9130
|
4
|
+
data.tar.gz: 2b48882f2251bb5200d7776dc7ba46cfdb92651dd7a94051e4ffea931942bee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd38e725718bd3e2eff039aa0c1fef81f98459d080646cbdfdd48c9d6db87819fd6b1ad7f3a406538d03b4520aa3ad531bed5a216296cb3b904aae1a09ec90e5
|
7
|
+
data.tar.gz: 6c94d7f6409777dcb8c89aa89f68f4d5f3281025e05700ae9f8905d98e0285b0b201db7a2b698033ad449a4998ed91df4a16e2ac73837915dae47a371d309c75
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.9.0
|
4
|
+
|
5
|
+
- Implement [Bot API 4.2](https://core.telegram.org/bots/api-changelog#april-14-2019)
|
6
|
+
- Implement [Bot API 4.1](https://core.telegram.org/bots/api-changelog#august-27-2018)
|
7
|
+
- Implement [Bot API 4.0](https://core.telegram.org/bots/api-changelog#july-26-2018)
|
8
|
+
- Implement [Bot API 3.6](https://core.telegram.org/bots/api-changelog#february-13-2018)
|
9
|
+
|
3
10
|
## 0.8.6.1
|
4
11
|
|
5
12
|
- Fix #163
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ $ gem install telegram-bot-ruby
|
|
29
29
|
|
30
30
|
## Usage
|
31
31
|
|
32
|
-
First things first, you need to [obtain a token](https://core.telegram.org/bots#botfather) for your bot. Then create your Telegram bot like this:
|
32
|
+
First things first, you need to [obtain a token](https://core.telegram.org/bots#6-botfather) for your bot. Then create your Telegram bot like this:
|
33
33
|
|
34
34
|
```ruby
|
35
35
|
require 'telegram/bot'
|
data/bin/console
CHANGED
data/lib/telegram/bot/api.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Telegram
|
2
2
|
module Bot
|
3
|
-
class Api
|
3
|
+
class Api # rubocop:disable ClassLength
|
4
4
|
ENDPOINTS = %w(
|
5
5
|
getUpdates setWebhook deleteWebhook getWebhookInfo getMe sendMessage
|
6
6
|
forwardMessage sendPhoto sendAudio sendDocument sendVideo sendVoice
|
@@ -16,7 +16,8 @@ module Telegram
|
|
16
16
|
uploadStickerFile createNewStickerSet addStickerToSet
|
17
17
|
setStickerPositionInSet deleteStickerFromSet answerInlineQuery
|
18
18
|
sendInvoice answerShippingQuery answerPreCheckoutQuery
|
19
|
-
sendGame setGameScore getGameHighScores
|
19
|
+
sendGame setGameScore getGameHighScores setPassportDataErrors
|
20
|
+
editMessageMedia sendAnimation sendPoll stopPoll
|
20
21
|
).freeze
|
21
22
|
REPLY_MARKUP_TYPES = [
|
22
23
|
Telegram::Bot::Types::ReplyKeyboardMarkup,
|
@@ -91,14 +92,14 @@ module Telegram
|
|
91
92
|
end
|
92
93
|
|
93
94
|
def jsonify_reply_markup(value)
|
94
|
-
return value unless REPLY_MARKUP_TYPES.
|
95
|
+
return value unless REPLY_MARKUP_TYPES.any? { |type| value.is_a?(type) }
|
95
96
|
value.to_compact_hash.to_json
|
96
97
|
end
|
97
98
|
|
98
99
|
def jsonify_inline_query_results(value)
|
99
100
|
return value unless
|
100
101
|
value.is_a?(Array) &&
|
101
|
-
value.all? { |i| INLINE_QUERY_RESULT_TYPES.
|
102
|
+
value.all? { |i| INLINE_QUERY_RESULT_TYPES.any? { |t| i.is_a?(t) } }
|
102
103
|
value.map { |i| i.to_compact_hash.select { |_, v| v } }.to_json
|
103
104
|
end
|
104
105
|
|
data/lib/telegram/bot/types.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'telegram/bot/types/compactable'
|
2
2
|
require 'telegram/bot/types/base'
|
3
3
|
require 'telegram/bot/types/user'
|
4
|
-
require 'telegram/bot/types/audio'
|
5
4
|
require 'telegram/bot/types/photo_size'
|
5
|
+
require 'telegram/bot/types/audio'
|
6
6
|
require 'telegram/bot/types/document'
|
7
7
|
require 'telegram/bot/types/mask_position'
|
8
8
|
require 'telegram/bot/types/sticker'
|
@@ -24,6 +24,8 @@ require 'telegram/bot/types/invoice'
|
|
24
24
|
require 'telegram/bot/types/shipping_address'
|
25
25
|
require 'telegram/bot/types/order_info'
|
26
26
|
require 'telegram/bot/types/successful_payment'
|
27
|
+
require 'telegram/bot/types/poll_option'
|
28
|
+
require 'telegram/bot/types/poll'
|
27
29
|
require 'telegram/bot/types/message'
|
28
30
|
require 'telegram/bot/types/input_message_content'
|
29
31
|
require 'telegram/bot/types/input_contact_message_content'
|
@@ -69,5 +71,21 @@ require 'telegram/bot/types/chat_member'
|
|
69
71
|
require 'telegram/bot/types/user_profile_photos'
|
70
72
|
require 'telegram/bot/types/input_media_photo'
|
71
73
|
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
|
+
require 'telegram/bot/types/input_media_animation'
|
88
|
+
require 'telegram/bot/types/input_media_audio'
|
89
|
+
require 'telegram/bot/types/input_media_document'
|
72
90
|
|
73
91
|
Virtus.finalize
|
@@ -14,6 +14,7 @@ module Telegram
|
|
14
14
|
attribute :can_restrict_members, Boolean
|
15
15
|
attribute :can_pin_messages, Boolean
|
16
16
|
attribute :can_promote_members, Boolean
|
17
|
+
attribute :is_member, Boolean
|
17
18
|
attribute :can_send_messages, Boolean
|
18
19
|
attribute :can_send_media_messages, Boolean
|
19
20
|
attribute :can_send_other_messages, Boolean
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class EncryptedPassportElement < Base
|
5
|
+
attribute :type, String
|
6
|
+
attribute :data, String
|
7
|
+
attribute :phone_number, String
|
8
|
+
attribute :email, String
|
9
|
+
attribute :files, Array[PassportFile]
|
10
|
+
attribute :front_side, PassportFile
|
11
|
+
attribute :reverse_side, PassportFile
|
12
|
+
attribute :selfie, PassportFile
|
13
|
+
attribute :translation, Array[PassportFile]
|
14
|
+
attribute :hash, String
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -7,6 +7,7 @@ module Telegram
|
|
7
7
|
attribute :phone_number, String
|
8
8
|
attribute :first_name, String
|
9
9
|
attribute :last_name, String
|
10
|
+
attribute :vcard, String
|
10
11
|
attribute :reply_markup, InlineKeyboardMarkup
|
11
12
|
attribute :input_message_content, InputMessageContent
|
12
13
|
attribute :thumb_url, String
|
@@ -9,6 +9,7 @@ module Telegram
|
|
9
9
|
attribute :title, String
|
10
10
|
attribute :address, String
|
11
11
|
attribute :foursquare_id, String
|
12
|
+
attribute :foursquare_type, String
|
12
13
|
attribute :reply_markup, InlineKeyboardMarkup
|
13
14
|
attribute :input_message_content, InputMessageContent
|
14
15
|
attribute :thumb_url, String
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class InputMediaAnimation < Base
|
5
|
+
attribute :type, String, default: 'animation'
|
6
|
+
attribute :media, String
|
7
|
+
attribute :thumb, String
|
8
|
+
attribute :caption, String
|
9
|
+
attribute :parse_mode, String
|
10
|
+
attribute :width, Integer
|
11
|
+
attribute :height, Integer
|
12
|
+
attribute :duration, Integer
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class InputMediaAudio < Base
|
5
|
+
attribute :type, String, default: 'audio'
|
6
|
+
attribute :media, String
|
7
|
+
attribute :thumb, String
|
8
|
+
attribute :caption, String
|
9
|
+
attribute :parse_mode, String
|
10
|
+
attribute :duration, Integer
|
11
|
+
attribute :performer, String
|
12
|
+
attribute :title, String
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class InputMediaDocument < Base
|
5
|
+
attribute :type, String, default: 'document'
|
6
|
+
attribute :media, String
|
7
|
+
attribute :thumb, String
|
8
|
+
attribute :caption, String
|
9
|
+
attribute :parse_mode, String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -10,15 +10,18 @@ module Telegram
|
|
10
10
|
attribute :forward_from_chat, Chat
|
11
11
|
attribute :forward_from_message_id, Integer
|
12
12
|
attribute :forward_signature, String
|
13
|
+
attribute :forward_sender_name, String
|
13
14
|
attribute :forward_date, Integer
|
14
15
|
attribute :reply_to_message, Message
|
15
16
|
attribute :edit_date, Integer
|
17
|
+
attribute :media_group_id, String
|
16
18
|
attribute :author_signature, String
|
17
19
|
attribute :text, String
|
18
20
|
attribute :entities, Array[MessageEntity]
|
19
21
|
attribute :caption_entities, Array[MessageEntity]
|
20
22
|
attribute :audio, Audio
|
21
23
|
attribute :document, Document
|
24
|
+
attribute :animation, Animation
|
22
25
|
attribute :game, Game
|
23
26
|
attribute :photo, Array[PhotoSize]
|
24
27
|
attribute :sticker, Sticker
|
@@ -29,6 +32,7 @@ module Telegram
|
|
29
32
|
attribute :contact, Contact
|
30
33
|
attribute :location, Location
|
31
34
|
attribute :venue, Venue
|
35
|
+
attribute :poll, Poll
|
32
36
|
attribute :new_chat_members, Array[User]
|
33
37
|
attribute :left_chat_member, User
|
34
38
|
attribute :new_chat_title, String
|
@@ -42,6 +46,7 @@ module Telegram
|
|
42
46
|
attribute :pinned_message, Message
|
43
47
|
attribute :invoice, Invoice
|
44
48
|
attribute :successful_payment, SuccessfulPayment
|
49
|
+
attribute :connected_website, String
|
45
50
|
|
46
51
|
alias to_s text
|
47
52
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class PassportElementErrorDataField < Base
|
5
|
+
attribute :source, String, default: 'data'
|
6
|
+
attribute :type, String
|
7
|
+
attribute :field_name, String
|
8
|
+
attribute :data_hash, String
|
9
|
+
attribute :message, String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class PassportElementErrorTranslationFile < Base
|
5
|
+
attribute :source, String, default: 'translation_file'
|
6
|
+
attribute :type, String
|
7
|
+
attribute :file_hash, String
|
8
|
+
attribute :message, String
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class PassportElementErrorTranslationFiles < Base
|
5
|
+
attribute :source, String, default: 'translation_files'
|
6
|
+
attribute :type, String
|
7
|
+
attribute :file_hashes, Array[String]
|
8
|
+
attribute :message, String
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class PassportElementErrorUnspecified < Base
|
5
|
+
attribute :source, String, default: 'unspecified'
|
6
|
+
attribute :type, String
|
7
|
+
attribute :element_hash, String
|
8
|
+
attribute :message, String
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/telegram/bot/version.rb
CHANGED
data/telegram-bot-ruby.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'virtus'
|
22
22
|
spec.add_dependency 'inflecto'
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1.9'
|
25
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
25
|
spec.add_development_dependency 'pry'
|
27
26
|
spec.add_development_dependency 'rubocop', '~> 0.48.1'
|
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.9.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: 2019-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.9'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.9'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,6 +163,8 @@ files:
|
|
177
163
|
- lib/telegram/bot/types/compactable.rb
|
178
164
|
- lib/telegram/bot/types/contact.rb
|
179
165
|
- lib/telegram/bot/types/document.rb
|
166
|
+
- lib/telegram/bot/types/encrypted_credentials.rb
|
167
|
+
- lib/telegram/bot/types/encrypted_passport_element.rb
|
180
168
|
- lib/telegram/bot/types/file.rb
|
181
169
|
- lib/telegram/bot/types/force_reply.rb
|
182
170
|
- lib/telegram/bot/types/game.rb
|
@@ -206,6 +194,9 @@ files:
|
|
206
194
|
- lib/telegram/bot/types/inline_query_result_voice.rb
|
207
195
|
- lib/telegram/bot/types/input_contact_message_content.rb
|
208
196
|
- lib/telegram/bot/types/input_location_message_content.rb
|
197
|
+
- lib/telegram/bot/types/input_media_animation.rb
|
198
|
+
- lib/telegram/bot/types/input_media_audio.rb
|
199
|
+
- lib/telegram/bot/types/input_media_document.rb
|
209
200
|
- lib/telegram/bot/types/input_media_photo.rb
|
210
201
|
- lib/telegram/bot/types/input_media_video.rb
|
211
202
|
- lib/telegram/bot/types/input_message_content.rb
|
@@ -219,7 +210,20 @@ files:
|
|
219
210
|
- lib/telegram/bot/types/message.rb
|
220
211
|
- lib/telegram/bot/types/message_entity.rb
|
221
212
|
- lib/telegram/bot/types/order_info.rb
|
213
|
+
- lib/telegram/bot/types/passport_data.rb
|
214
|
+
- lib/telegram/bot/types/passport_element_error_data_field.rb
|
215
|
+
- lib/telegram/bot/types/passport_element_error_file.rb
|
216
|
+
- lib/telegram/bot/types/passport_element_error_files.rb
|
217
|
+
- lib/telegram/bot/types/passport_element_error_front_side.rb
|
218
|
+
- lib/telegram/bot/types/passport_element_error_reverse_side.rb
|
219
|
+
- lib/telegram/bot/types/passport_element_error_selfie.rb
|
220
|
+
- lib/telegram/bot/types/passport_element_error_translation_file.rb
|
221
|
+
- lib/telegram/bot/types/passport_element_error_translation_files.rb
|
222
|
+
- lib/telegram/bot/types/passport_element_error_unspecified.rb
|
223
|
+
- lib/telegram/bot/types/passport_file.rb
|
222
224
|
- lib/telegram/bot/types/photo_size.rb
|
225
|
+
- lib/telegram/bot/types/poll.rb
|
226
|
+
- lib/telegram/bot/types/poll_option.rb
|
223
227
|
- lib/telegram/bot/types/pre_checkout_query.rb
|
224
228
|
- lib/telegram/bot/types/reply_keyboard_markup.rb
|
225
229
|
- lib/telegram/bot/types/reply_keyboard_remove.rb
|
@@ -256,8 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
260
|
- !ruby/object:Gem::Version
|
257
261
|
version: '0'
|
258
262
|
requirements: []
|
259
|
-
|
260
|
-
rubygems_version: 2.6.13
|
263
|
+
rubygems_version: 3.0.3
|
261
264
|
signing_key:
|
262
265
|
specification_version: 4
|
263
266
|
summary: Ruby wrapper for Telegram's Bot API
|