telegram-bot-ruby 0.11.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -10
- data/.travis.yml +2 -1
- data/CHANGELOG.md +23 -0
- data/Rakefile +2 -2
- data/lib/telegram/bot.rb +0 -1
- data/lib/telegram/bot/api.rb +10 -39
- data/lib/telegram/bot/client.rb +10 -6
- data/lib/telegram/bot/null_logger.rb +2 -4
- data/lib/telegram/bot/types.rb +14 -1
- data/lib/telegram/bot/types/animation.rb +4 -0
- data/lib/telegram/bot/types/audio.rb +2 -0
- data/lib/telegram/bot/types/base.rb +1 -0
- data/lib/telegram/bot/types/chat.rb +4 -0
- data/lib/telegram/bot/types/chat_invite_link.rb +14 -0
- data/lib/telegram/bot/types/chat_location.rb +10 -0
- data/lib/telegram/bot/types/chat_member.rb +5 -1
- data/lib/telegram/bot/types/chat_member_updated.rb +14 -0
- data/lib/telegram/bot/types/chat_photo.rb +2 -0
- data/lib/telegram/bot/types/compactable.rb +5 -1
- 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_query_result_audio.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_cached_document.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_cached_video.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_document.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_gif.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_location.rb +4 -0
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_photo.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_venue.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result_video.rb +1 -0
- data/lib/telegram/bot/types/inline_query_result_voice.rb +1 -0
- data/lib/telegram/bot/types/input_location_message_content.rb +4 -0
- data/lib/telegram/bot/types/input_media_document.rb +2 -0
- data/lib/telegram/bot/types/input_media_photo.rb +1 -0
- data/lib/telegram/bot/types/input_media_video.rb +1 -0
- data/lib/telegram/bot/types/input_venue_message_content.rb +2 -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/location.rb +4 -0
- data/lib/telegram/bot/types/message.rb +8 -0
- data/lib/telegram/bot/types/message_auto_delete_timer_changed.rb +9 -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/pattern_matching.rb +11 -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/proximity_alert_triggered.rb +11 -0
- data/lib/telegram/bot/types/sticker.rb +1 -0
- data/lib/telegram/bot/types/sticker_set.rb +1 -0
- data/lib/telegram/bot/types/update.rb +3 -0
- data/lib/telegram/bot/types/user.rb +3 -0
- data/lib/telegram/bot/types/venue.rb +2 -0
- data/lib/telegram/bot/types/video.rb +2 -0
- data/lib/telegram/bot/types/video_note.rb +1 -0
- data/lib/telegram/bot/types/voice.rb +1 -0
- data/lib/telegram/bot/types/voice_chat_ended.rb +9 -0
- data/lib/telegram/bot/types/voice_chat_participants_invited.rb +9 -0
- data/lib/telegram/bot/types/voice_chat_started.rb +8 -0
- data/lib/telegram/bot/types/webhook_info.rb +17 -0
- data/lib/telegram/bot/version.rb +1 -1
- data/telegram-bot-ruby.gemspec +3 -3
- metadata +27 -15
- data/.rubocop_todo.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6227a7eff23e7037a7e07e021a4f2925681c952a449b99a38cd5c23b3f331c5c
|
4
|
+
data.tar.gz: a1bc35c582ff1ba5fe4627613e6c71454be8c11877a5a1fdca7ca300a1a1fead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39ff75cc41a8fcfa5558a28cedb8e9f3b4be72e40fca71a4f8a9a1493bcd67850c6598e84882b2db7edee2c46202b72756d1612f477909fc1097211d7a95f1da
|
7
|
+
data.tar.gz: fb29319e282a3b851689503657f1877511555b10be4135bc9c99ad192093c3ea7f96e352a32bb2cb50bedc5dd206944f2604d135b15a9375a678186c244c385b
|
data/.rubocop.yml
CHANGED
@@ -1,18 +1,16 @@
|
|
1
|
-
|
1
|
+
---
|
2
2
|
require: rubocop-rspec
|
3
3
|
|
4
|
+
Style/Documentation:
|
5
|
+
Enabled: false
|
6
|
+
|
4
7
|
Metrics/BlockLength:
|
5
|
-
|
6
|
-
-
|
8
|
+
ExcludedMethods:
|
9
|
+
- context
|
10
|
+
- describe
|
7
11
|
|
8
12
|
Metrics/LineLength:
|
13
|
+
Max: 120
|
9
14
|
Exclude:
|
10
15
|
- telegram-bot-ruby.gemspec
|
11
16
|
- examples/*.rb
|
12
|
-
|
13
|
-
Style/EmptyMethod:
|
14
|
-
EnforcedStyle: expanded
|
15
|
-
|
16
|
-
Style/PercentLiteralDelimiters:
|
17
|
-
PreferredDelimiters:
|
18
|
-
'%w': '()'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.16.0
|
4
|
+
|
5
|
+
- Replace `inflecto` with `dry-inflector`
|
6
|
+
- Update `virtus` up to 2.0
|
7
|
+
|
8
|
+
## 0.15.0
|
9
|
+
|
10
|
+
- Implement [Bot API 5.1](https://core.telegram.org/bots/api#march-9-2021)
|
11
|
+
|
12
|
+
## 0.14.0
|
13
|
+
|
14
|
+
- Implement [Bot API 5.0](https://core.telegram.org/bots/api#november-4-2020)
|
15
|
+
|
16
|
+
## 0.13.0
|
17
|
+
|
18
|
+
- Implement [Bot API 4.9](https://core.telegram.org/bots/api-changelog#june-4-2020)
|
19
|
+
- Implement [Bot API 4.8](https://core.telegram.org/bots/api-changelog#april-24-2020)
|
20
|
+
- Implement [Bot API 4.7](https://core.telegram.org/bots/api-changelog#march-30-2020)
|
21
|
+
|
22
|
+
## 0.12.0
|
23
|
+
|
24
|
+
- 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)
|
25
|
+
|
3
26
|
## 0.11.0
|
4
27
|
|
5
28
|
- Implement [Bot API 4.4](https://core.telegram.org/bots/api#july-29-2019)
|
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ require 'rspec/core/rake_task'
|
|
5
5
|
|
6
6
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
7
7
|
task.fail_on_error = false
|
8
|
-
task.options = %w
|
9
|
-
task.patterns = %w
|
8
|
+
task.options = %w[--force-exclusion]
|
9
|
+
task.patterns = %w[lib/**/*.rb]
|
10
10
|
task.requires << 'rubocop-rspec'
|
11
11
|
end
|
12
12
|
|
data/lib/telegram/bot.rb
CHANGED
data/lib/telegram/bot/api.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Telegram
|
2
2
|
module Bot
|
3
|
-
class Api
|
4
|
-
ENDPOINTS = %w
|
3
|
+
class Api
|
4
|
+
ENDPOINTS = %w[
|
5
5
|
getUpdates setWebhook deleteWebhook getWebhookInfo getMe sendMessage
|
6
6
|
forwardMessage sendPhoto sendAudio sendDocument sendVideo sendVoice
|
7
7
|
sendVideoNote sendMediaGroup sendLocation editMessageLiveLocation
|
@@ -18,34 +18,9 @@ module Telegram
|
|
18
18
|
sendInvoice answerShippingQuery answerPreCheckoutQuery
|
19
19
|
sendGame setGameScore getGameHighScores setPassportDataErrors
|
20
20
|
editMessageMedia sendAnimation sendPoll stopPoll setChatPermissions
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Telegram::Bot::Types::ReplyKeyboardRemove,
|
25
|
-
Telegram::Bot::Types::ForceReply,
|
26
|
-
Telegram::Bot::Types::InlineKeyboardMarkup
|
27
|
-
].freeze
|
28
|
-
INLINE_QUERY_RESULT_TYPES = [
|
29
|
-
Telegram::Bot::Types::InlineQueryResultArticle,
|
30
|
-
Telegram::Bot::Types::InlineQueryResultPhoto,
|
31
|
-
Telegram::Bot::Types::InlineQueryResultGif,
|
32
|
-
Telegram::Bot::Types::InlineQueryResultMpeg4Gif,
|
33
|
-
Telegram::Bot::Types::InlineQueryResultVideo,
|
34
|
-
Telegram::Bot::Types::InlineQueryResultAudio,
|
35
|
-
Telegram::Bot::Types::InlineQueryResultVoice,
|
36
|
-
Telegram::Bot::Types::InlineQueryResultDocument,
|
37
|
-
Telegram::Bot::Types::InlineQueryResultLocation,
|
38
|
-
Telegram::Bot::Types::InlineQueryResultVenue,
|
39
|
-
Telegram::Bot::Types::InlineQueryResultContact,
|
40
|
-
Telegram::Bot::Types::InlineQueryResultGame,
|
41
|
-
Telegram::Bot::Types::InlineQueryResultCachedPhoto,
|
42
|
-
Telegram::Bot::Types::InlineQueryResultCachedGif,
|
43
|
-
Telegram::Bot::Types::InlineQueryResultCachedMpeg4Gif,
|
44
|
-
Telegram::Bot::Types::InlineQueryResultCachedSticker,
|
45
|
-
Telegram::Bot::Types::InlineQueryResultCachedDocument,
|
46
|
-
Telegram::Bot::Types::InlineQueryResultCachedVideo,
|
47
|
-
Telegram::Bot::Types::InlineQueryResultCachedVoice,
|
48
|
-
Telegram::Bot::Types::InlineQueryResultCachedAudio
|
21
|
+
setChatAdministratorCustomTitle sendDice getMyCommands setMyCommands
|
22
|
+
setStickerSetThumb logOut close copyMessage createChatInviteLink
|
23
|
+
editChatInviteLink revokeChatInviteLink
|
49
24
|
].freeze
|
50
25
|
|
51
26
|
attr_reader :token, :url
|
@@ -89,19 +64,15 @@ module Telegram
|
|
89
64
|
end
|
90
65
|
|
91
66
|
def sanitize_value(value)
|
92
|
-
|
67
|
+
jsonify_value(value)
|
93
68
|
end
|
94
69
|
|
95
|
-
def
|
96
|
-
|
97
|
-
value.to_compact_hash.to_json
|
70
|
+
def jsonify_value(value)
|
71
|
+
jsonify_value?(value) ? value.to_json : value
|
98
72
|
end
|
99
73
|
|
100
|
-
def
|
101
|
-
|
102
|
-
value.is_a?(Array) &&
|
103
|
-
value.all? { |i| INLINE_QUERY_RESULT_TYPES.any? { |t| i.is_a?(t) } }
|
104
|
-
value.map { |i| i.to_compact_hash.select { |_, v| v } }.to_json
|
74
|
+
def jsonify_value?(value)
|
75
|
+
value.respond_to?(:to_compact_hash) || value.is_a?(Array)
|
105
76
|
end
|
106
77
|
|
107
78
|
def camelize(method_name)
|
data/lib/telegram/bot/client.rb
CHANGED
@@ -31,16 +31,20 @@ module Telegram
|
|
31
31
|
return unless response['ok']
|
32
32
|
|
33
33
|
response['result'].each do |data|
|
34
|
-
|
35
|
-
@options[:offset] = update.update_id.next
|
36
|
-
message = update.current_message
|
37
|
-
log_incoming_message(message)
|
38
|
-
yield message
|
34
|
+
yield handle_update(Types::Update.new(data))
|
39
35
|
end
|
40
|
-
rescue Faraday::
|
36
|
+
rescue Faraday::TimeoutError
|
41
37
|
retry
|
42
38
|
end
|
43
39
|
|
40
|
+
def handle_update(update)
|
41
|
+
@options[:offset] = update.update_id.next
|
42
|
+
message = update.current_message
|
43
|
+
log_incoming_message(message)
|
44
|
+
|
45
|
+
message
|
46
|
+
end
|
47
|
+
|
44
48
|
private
|
45
49
|
|
46
50
|
def default_options
|
data/lib/telegram/bot/types.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'telegram/bot/types/compactable'
|
2
|
+
require 'telegram/bot/types/pattern_matching'
|
2
3
|
require 'telegram/bot/types/base'
|
3
4
|
require 'telegram/bot/types/user'
|
4
5
|
require 'telegram/bot/types/photo_size'
|
@@ -11,6 +12,7 @@ require 'telegram/bot/types/video'
|
|
11
12
|
require 'telegram/bot/types/voice'
|
12
13
|
require 'telegram/bot/types/video_note'
|
13
14
|
require 'telegram/bot/types/contact'
|
15
|
+
require 'telegram/bot/types/dice'
|
14
16
|
require 'telegram/bot/types/location'
|
15
17
|
require 'telegram/bot/types/chat_photo'
|
16
18
|
require 'telegram/bot/types/chat_permissions'
|
@@ -26,6 +28,7 @@ require 'telegram/bot/types/shipping_address'
|
|
26
28
|
require 'telegram/bot/types/order_info'
|
27
29
|
require 'telegram/bot/types/successful_payment'
|
28
30
|
require 'telegram/bot/types/poll_option'
|
31
|
+
require 'telegram/bot/types/poll_answer'
|
29
32
|
require 'telegram/bot/types/poll'
|
30
33
|
require 'telegram/bot/types/passport_file'
|
31
34
|
require 'telegram/bot/types/encrypted_passport_element'
|
@@ -70,11 +73,16 @@ require 'telegram/bot/types/inline_query_result_venue'
|
|
70
73
|
require 'telegram/bot/types/inline_query_result_video'
|
71
74
|
require 'telegram/bot/types/inline_query_result_voice'
|
72
75
|
require 'telegram/bot/types/chosen_inline_result'
|
76
|
+
require 'telegram/bot/types/proximity_alert_triggered'
|
77
|
+
require 'telegram/bot/types/voice_chat_started'
|
78
|
+
require 'telegram/bot/types/voice_chat_ended'
|
79
|
+
require 'telegram/bot/types/voice_chat_participants_invited'
|
80
|
+
require 'telegram/bot/types/message_auto_delete_timer_changed'
|
73
81
|
require 'telegram/bot/types/message'
|
74
82
|
require 'telegram/bot/types/callback_query'
|
75
83
|
require 'telegram/bot/types/shipping_query'
|
76
84
|
require 'telegram/bot/types/pre_checkout_query'
|
77
|
-
require 'telegram/bot/types/
|
85
|
+
require 'telegram/bot/types/keyboard_button_poll_type'
|
78
86
|
require 'telegram/bot/types/keyboard_button'
|
79
87
|
require 'telegram/bot/types/reply_keyboard_markup'
|
80
88
|
require 'telegram/bot/types/reply_keyboard_remove'
|
@@ -82,12 +90,17 @@ require 'telegram/bot/types/force_reply'
|
|
82
90
|
require 'telegram/bot/types/file'
|
83
91
|
require 'telegram/bot/types/labeled_price'
|
84
92
|
require 'telegram/bot/types/shipping_option'
|
93
|
+
require 'telegram/bot/types/chat_invite_link'
|
85
94
|
require 'telegram/bot/types/chat_member'
|
95
|
+
require 'telegram/bot/types/chat_member_updated'
|
96
|
+
require 'telegram/bot/types/update'
|
86
97
|
require 'telegram/bot/types/user_profile_photos'
|
87
98
|
require 'telegram/bot/types/input_media_photo'
|
88
99
|
require 'telegram/bot/types/input_media_video'
|
89
100
|
require 'telegram/bot/types/input_media_animation'
|
90
101
|
require 'telegram/bot/types/input_media_audio'
|
91
102
|
require 'telegram/bot/types/input_media_document'
|
103
|
+
require 'telegram/bot/types/webhook_info'
|
104
|
+
require 'telegram/bot/types/chat_location'
|
92
105
|
|
93
106
|
Virtus.finalize
|
@@ -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
|
@@ -3,9 +3,11 @@ module Telegram
|
|
3
3
|
module Types
|
4
4
|
class Audio < Base
|
5
5
|
attribute :file_id, String
|
6
|
+
attribute :file_unique_id, String
|
6
7
|
attribute :duration, Integer
|
7
8
|
attribute :performer, String
|
8
9
|
attribute :title, String
|
10
|
+
attribute :file_name, String
|
9
11
|
attribute :mime_type, String
|
10
12
|
attribute :file_size, Integer
|
11
13
|
attribute :thumb, PhotoSize
|
@@ -4,6 +4,7 @@ module Telegram
|
|
4
4
|
class Chat
|
5
5
|
include Virtus.model(finalize: false)
|
6
6
|
include Compactable
|
7
|
+
include PatternMatching
|
7
8
|
|
8
9
|
attribute :id, Integer
|
9
10
|
attribute :type, String
|
@@ -17,6 +18,9 @@ module Telegram
|
|
17
18
|
attribute :invite_link, String
|
18
19
|
attribute :pinned_message, 'Telegram::Bot::Types::Message'
|
19
20
|
attribute :permissions, ChatPermissions
|
21
|
+
attribute :slow_mode_delay, Integer
|
22
|
+
attribute :sticker_set_name, String
|
23
|
+
attribute :can_set_sticker_set, Boolean
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class ChatInviteLink < Base
|
5
|
+
attribute :invite_link, String
|
6
|
+
attribute :creator, User
|
7
|
+
attribute :is_primary, Boolean
|
8
|
+
attribute :is_revoked, Boolean
|
9
|
+
attribute :expire_date, Integer
|
10
|
+
attribute :member_limit, Integer
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -4,11 +4,14 @@ module Telegram
|
|
4
4
|
class ChatMember < Base
|
5
5
|
attribute :user, User
|
6
6
|
attribute :status, String
|
7
|
-
attribute :
|
7
|
+
attribute :custom_title, String
|
8
|
+
attribute :is_anonymous, Boolean
|
8
9
|
attribute :can_be_edited, Boolean
|
10
|
+
attribute :can_manage_chat, Boolean
|
9
11
|
attribute :can_post_messages, Boolean
|
10
12
|
attribute :can_edit_messages, Boolean
|
11
13
|
attribute :can_delete_messages, Boolean
|
14
|
+
attribute :can_manage_voice_chats, Boolean
|
12
15
|
attribute :can_restrict_members, Boolean
|
13
16
|
attribute :can_promote_members, Boolean
|
14
17
|
attribute :can_change_info, Boolean
|
@@ -20,6 +23,7 @@ module Telegram
|
|
20
23
|
attribute :can_send_polls, Boolean
|
21
24
|
attribute :can_send_other_messages, Boolean
|
22
25
|
attribute :can_add_web_page_previews, Boolean
|
26
|
+
attribute :until_date, Integer
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class ChatMemberUpdated < Base
|
5
|
+
attribute :chat, Chat
|
6
|
+
attribute :from, User
|
7
|
+
attribute :date, Integer
|
8
|
+
attribute :old_chat_member, ChatMember
|
9
|
+
attribute :new_chat_member, ChatMember
|
10
|
+
attribute :invite_link, ChatInviteLink
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -5,7 +5,7 @@ module Telegram
|
|
5
5
|
def to_compact_hash
|
6
6
|
Hash[attributes.dup.delete_if { |_, v| v.nil? }.map do |key, value|
|
7
7
|
value =
|
8
|
-
if value.
|
8
|
+
if value.respond_to?(:to_compact_hash)
|
9
9
|
value.to_compact_hash
|
10
10
|
else
|
11
11
|
value
|
@@ -14,6 +14,10 @@ module Telegram
|
|
14
14
|
[key, value]
|
15
15
|
end]
|
16
16
|
end
|
17
|
+
|
18
|
+
def to_json(*args)
|
19
|
+
to_compact_hash.select { |_, v| v }.to_json(*args)
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
@@ -7,6 +7,10 @@ module Telegram
|
|
7
7
|
attribute :latitude, Float
|
8
8
|
attribute :longitude, Float
|
9
9
|
attribute :title, String
|
10
|
+
attribute :horizontal_accuracy, Float
|
11
|
+
attribute :live_period, Integer
|
12
|
+
attribute :heading, Integer
|
13
|
+
attribute :proximity_alert_radius, Integer
|
10
14
|
attribute :reply_markup, InlineKeyboardMarkup
|
11
15
|
attribute :input_message_content, InputMessageContent
|
12
16
|
attribute :thumb_url, String
|
@@ -9,8 +9,10 @@ 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
|
15
|
+
attribute :parse_mode, String
|
14
16
|
attribute :reply_markup, InlineKeyboardMarkup
|
15
17
|
attribute :input_message_content, InputMessageContent
|
16
18
|
end
|
@@ -10,6 +10,8 @@ module Telegram
|
|
10
10
|
attribute :address, String
|
11
11
|
attribute :foursquare_id, String
|
12
12
|
attribute :foursquare_type, String
|
13
|
+
attribute :google_place_id, String
|
14
|
+
attribute :google_place_type, String
|
13
15
|
attribute :reply_markup, InlineKeyboardMarkup
|
14
16
|
attribute :input_message_content, InputMessageContent
|
15
17
|
attribute :thumb_url, String
|
@@ -7,6 +7,7 @@ module Telegram
|
|
7
7
|
attribute :voice_url, String
|
8
8
|
attribute :title, String
|
9
9
|
attribute :caption, String
|
10
|
+
attribute :parse_mode, String
|
10
11
|
attribute :voice_duration, Integer
|
11
12
|
attribute :reply_markup, InlineKeyboardMarkup
|
12
13
|
attribute :input_message_content, InputMessageContent
|
@@ -4,6 +4,10 @@ module Telegram
|
|
4
4
|
class InputLocationMessageContent < InputMessageContent
|
5
5
|
attribute :latitude, Float
|
6
6
|
attribute :longitude, Float
|
7
|
+
attribute :horizontal_accuracy, Float
|
8
|
+
attribute :live_period, Integer
|
9
|
+
attribute :heading, Integer
|
10
|
+
attribute :proximity_alert_radius, Integer
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -4,6 +4,10 @@ module Telegram
|
|
4
4
|
class Location < Base
|
5
5
|
attribute :longitude, Float
|
6
6
|
attribute :latitude, Float
|
7
|
+
attribute :horizontal_accuracy, Float
|
8
|
+
attribute :live_period, Integer
|
9
|
+
attribute :heading, Integer
|
10
|
+
attribute :proximity_alert_radius, Integer
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -4,6 +4,7 @@ module Telegram
|
|
4
4
|
class Message < Base
|
5
5
|
attribute :message_id, Integer
|
6
6
|
attribute :from, User
|
7
|
+
attribute :sender_chat, Chat
|
7
8
|
attribute :date, Integer
|
8
9
|
attribute :chat, Chat
|
9
10
|
attribute :forward_from, User
|
@@ -13,6 +14,7 @@ module Telegram
|
|
13
14
|
attribute :forward_sender_name, String
|
14
15
|
attribute :forward_date, Integer
|
15
16
|
attribute :reply_to_message, Message
|
17
|
+
attribute :via_bot, User
|
16
18
|
attribute :edit_date, Integer
|
17
19
|
attribute :media_group_id, String
|
18
20
|
attribute :author_signature, String
|
@@ -30,6 +32,7 @@ module Telegram
|
|
30
32
|
attribute :video_note, VideoNote
|
31
33
|
attribute :caption, String
|
32
34
|
attribute :contact, Contact
|
35
|
+
attribute :dice, Dice
|
33
36
|
attribute :location, Location
|
34
37
|
attribute :venue, Venue
|
35
38
|
attribute :poll, Poll
|
@@ -41,6 +44,7 @@ module Telegram
|
|
41
44
|
attribute :group_chat_created, Boolean
|
42
45
|
attribute :supergroup_chat_created, Boolean
|
43
46
|
attribute :channel_chat_created, Boolean
|
47
|
+
attribute :message_auto_delete_timer_changed, MessageAutoDeleteTimerChanged
|
44
48
|
attribute :migrate_to_chat_id, Integer
|
45
49
|
attribute :migrate_from_chat_id, Integer
|
46
50
|
attribute :pinned_message, Message
|
@@ -48,6 +52,10 @@ module Telegram
|
|
48
52
|
attribute :successful_payment, SuccessfulPayment
|
49
53
|
attribute :connected_website, String
|
50
54
|
attribute :passport_data, PassportData
|
55
|
+
attribute :proximity_alert_triggered, ProximityAlertTriggered
|
56
|
+
attribute :voice_chat_started, VoiceChatStarted
|
57
|
+
attribute :voice_chat_ended, VoiceChatEnded
|
58
|
+
attribute :voice_chat_participants_invited, VoiceChatParticipantsInvited
|
51
59
|
attribute :reply_markup, InlineKeyboardMarkup
|
52
60
|
|
53
61
|
alias to_s text
|
@@ -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
|
@@ -13,6 +13,9 @@ module Telegram
|
|
13
13
|
attribute :shipping_query, ShippingQuery
|
14
14
|
attribute :pre_checkout_query, PreCheckoutQuery
|
15
15
|
attribute :poll, Poll
|
16
|
+
attribute :poll_answer, PollAnswer
|
17
|
+
attribute :my_chat_member, ChatMemberUpdated
|
18
|
+
attribute :chat_member, ChatMemberUpdated
|
16
19
|
|
17
20
|
def current_message
|
18
21
|
@current_message ||=
|
@@ -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
|
@@ -3,10 +3,12 @@ module Telegram
|
|
3
3
|
module Types
|
4
4
|
class Video < Base
|
5
5
|
attribute :file_id, String
|
6
|
+
attribute :file_unique_id, String
|
6
7
|
attribute :width, Integer
|
7
8
|
attribute :height, Integer
|
8
9
|
attribute :duration, Integer
|
9
10
|
attribute :thumb, PhotoSize
|
11
|
+
attribute :file_name, String
|
10
12
|
attribute :mime_type, String
|
11
13
|
attribute :file_size, Integer
|
12
14
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Telegram
|
2
|
+
module Bot
|
3
|
+
module Types
|
4
|
+
class WebhookInfo < Base
|
5
|
+
attribute :url, String
|
6
|
+
attribute :has_custom_certificate, Boolean
|
7
|
+
attribute :pending_update_count, Integer
|
8
|
+
attribute :ip_address, String
|
9
|
+
attribute :last_error_date, Integer
|
10
|
+
attribute :last_error_message, String
|
11
|
+
attribute :max_connections, String
|
12
|
+
attribute :max_connections, Integer
|
13
|
+
attribute :allowed_updates, Array[String]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/telegram/bot/version.rb
CHANGED
data/telegram-bot-ruby.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_dependency 'faraday'
|
21
|
-
spec.add_dependency 'virtus'
|
22
|
-
spec.add_dependency '
|
21
|
+
spec.add_dependency 'virtus', '~> 2.0'
|
22
|
+
spec.add_dependency 'dry-inflector'
|
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.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Tipugin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -28,18 +28,18 @@ dependencies:
|
|
28
28
|
name: virtus
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: dry-inflector
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -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
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1.8'
|
125
|
-
description:
|
125
|
+
description:
|
126
126
|
email:
|
127
127
|
- atipugin@gmail.com
|
128
128
|
executables: []
|
@@ -132,7 +132,6 @@ files:
|
|
132
132
|
- ".gitignore"
|
133
133
|
- ".rspec"
|
134
134
|
- ".rubocop.yml"
|
135
|
-
- ".rubocop_todo.yml"
|
136
135
|
- ".travis.yml"
|
137
136
|
- CHANGELOG.md
|
138
137
|
- Gemfile
|
@@ -157,12 +156,16 @@ files:
|
|
157
156
|
- lib/telegram/bot/types/callback_game.rb
|
158
157
|
- lib/telegram/bot/types/callback_query.rb
|
159
158
|
- lib/telegram/bot/types/chat.rb
|
159
|
+
- lib/telegram/bot/types/chat_invite_link.rb
|
160
|
+
- lib/telegram/bot/types/chat_location.rb
|
160
161
|
- lib/telegram/bot/types/chat_member.rb
|
162
|
+
- lib/telegram/bot/types/chat_member_updated.rb
|
161
163
|
- lib/telegram/bot/types/chat_permissions.rb
|
162
164
|
- lib/telegram/bot/types/chat_photo.rb
|
163
165
|
- lib/telegram/bot/types/chosen_inline_result.rb
|
164
166
|
- lib/telegram/bot/types/compactable.rb
|
165
167
|
- lib/telegram/bot/types/contact.rb
|
168
|
+
- lib/telegram/bot/types/dice.rb
|
166
169
|
- lib/telegram/bot/types/document.rb
|
167
170
|
- lib/telegram/bot/types/encrypted_credentials.rb
|
168
171
|
- lib/telegram/bot/types/encrypted_passport_element.rb
|
@@ -205,11 +208,13 @@ files:
|
|
205
208
|
- lib/telegram/bot/types/input_venue_message_content.rb
|
206
209
|
- lib/telegram/bot/types/invoice.rb
|
207
210
|
- lib/telegram/bot/types/keyboard_button.rb
|
211
|
+
- lib/telegram/bot/types/keyboard_button_poll_type.rb
|
208
212
|
- lib/telegram/bot/types/labeled_price.rb
|
209
213
|
- lib/telegram/bot/types/location.rb
|
210
214
|
- lib/telegram/bot/types/login_url.rb
|
211
215
|
- lib/telegram/bot/types/mask_position.rb
|
212
216
|
- lib/telegram/bot/types/message.rb
|
217
|
+
- lib/telegram/bot/types/message_auto_delete_timer_changed.rb
|
213
218
|
- lib/telegram/bot/types/message_entity.rb
|
214
219
|
- lib/telegram/bot/types/order_info.rb
|
215
220
|
- lib/telegram/bot/types/passport_data.rb
|
@@ -223,10 +228,13 @@ files:
|
|
223
228
|
- lib/telegram/bot/types/passport_element_error_translation_files.rb
|
224
229
|
- lib/telegram/bot/types/passport_element_error_unspecified.rb
|
225
230
|
- lib/telegram/bot/types/passport_file.rb
|
231
|
+
- lib/telegram/bot/types/pattern_matching.rb
|
226
232
|
- lib/telegram/bot/types/photo_size.rb
|
227
233
|
- lib/telegram/bot/types/poll.rb
|
234
|
+
- lib/telegram/bot/types/poll_answer.rb
|
228
235
|
- lib/telegram/bot/types/poll_option.rb
|
229
236
|
- lib/telegram/bot/types/pre_checkout_query.rb
|
237
|
+
- lib/telegram/bot/types/proximity_alert_triggered.rb
|
230
238
|
- lib/telegram/bot/types/reply_keyboard_markup.rb
|
231
239
|
- lib/telegram/bot/types/reply_keyboard_remove.rb
|
232
240
|
- lib/telegram/bot/types/shipping_address.rb
|
@@ -242,12 +250,16 @@ files:
|
|
242
250
|
- lib/telegram/bot/types/video.rb
|
243
251
|
- lib/telegram/bot/types/video_note.rb
|
244
252
|
- lib/telegram/bot/types/voice.rb
|
253
|
+
- lib/telegram/bot/types/voice_chat_ended.rb
|
254
|
+
- lib/telegram/bot/types/voice_chat_participants_invited.rb
|
255
|
+
- lib/telegram/bot/types/voice_chat_started.rb
|
256
|
+
- lib/telegram/bot/types/webhook_info.rb
|
245
257
|
- lib/telegram/bot/version.rb
|
246
258
|
- telegram-bot-ruby.gemspec
|
247
259
|
homepage: https://github.com/atipugin/telegram-bot
|
248
260
|
licenses: []
|
249
261
|
metadata: {}
|
250
|
-
post_install_message:
|
262
|
+
post_install_message:
|
251
263
|
rdoc_options: []
|
252
264
|
require_paths:
|
253
265
|
- lib
|
@@ -262,8 +274,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
274
|
- !ruby/object:Gem::Version
|
263
275
|
version: '0'
|
264
276
|
requirements: []
|
265
|
-
rubygems_version: 3.
|
266
|
-
signing_key:
|
277
|
+
rubygems_version: 3.2.15
|
278
|
+
signing_key:
|
267
279
|
specification_version: 4
|
268
280
|
summary: Ruby wrapper for Telegram's Bot API
|
269
281
|
test_files: []
|
data/.rubocop_todo.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on 2015-06-27 20:51:46 +0300 using RuboCop version 0.32.1.
|
3
|
-
# The point is for the user to remove these configuration records
|
4
|
-
# one by one as the offenses are removed from the code base.
|
5
|
-
# Note that changes in the inspected code, or installation of new
|
6
|
-
# versions of RuboCop, may require this file to be generated again.
|
7
|
-
|
8
|
-
Metrics/MethodLength:
|
9
|
-
Max: 11
|
10
|
-
|
11
|
-
# Offense count: 15
|
12
|
-
Style/Documentation:
|
13
|
-
Enabled: false
|