telegram-bot-ruby 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0ba0d92965d18c16f771efe9627014c8eed215ed5df52ffd42941fcb6fe9aac
4
- data.tar.gz: 6d6878ef985d34e14277c682c793477e4a9bd8feabce322c5a14017de1364ed9
3
+ metadata.gz: 9b39d62dd4efff4ab96664e0cc4a0ce3eee6631ea8b96c3b90be993f8bae6d34
4
+ data.tar.gz: e7afcb7986690e5e512faa9caec4abe13f85e21252e86f13af48968ae990bca0
5
5
  SHA512:
6
- metadata.gz: 6242afc917fb38d18f24b7ceeb27224464ffc8e71acc17aecf03296368f07c9a56b05e4b7d0b8d3a8c27ccab978fe544017dece71fcb4087154e37ce09d39f35
7
- data.tar.gz: 7807d1b0f930714927c26f1295cbaecedd3a51f0342e50abcb2aff09aa4da56086609bb2ac18235a1084aef023936e06975368a8a4f7d2a2580d7bdcb5f49cb2
6
+ metadata.gz: 527a11835b057bc29fdbeecd22350b86b1f3bfdd9bc3c328e11b5fe275fd47847c946bc4bf7b3f804f25b9f9dee8a693c54bb3d6ebf8d64a1a009995b59d03e9
7
+ data.tar.gz: 839b7b1c0c03c4109ebcdc6f777af0f90013393f35407b113c6805d7740bc9326dc2e4236b465f76387db38656832aa615178bcc96b5c13a0fdb1ebbbedbc356
data/.rubocop.yml CHANGED
@@ -1,18 +1,15 @@
1
- inherit_from: .rubocop_todo.yml
1
+ ---
2
2
  require: rubocop-rspec
3
3
 
4
+ Style/Documentation:
5
+ Enabled: false
6
+
4
7
  Metrics/BlockLength:
5
- Exclude:
6
- - spec/**/*.rb
8
+ ExcludedMethods:
9
+ - context
10
+ - describe
7
11
 
8
12
  Metrics/LineLength:
9
13
  Exclude:
10
14
  - telegram-bot-ruby.gemspec
11
15
  - examples/*.rb
12
-
13
- Style/EmptyMethod:
14
- EnforcedStyle: expanded
15
-
16
- Style/PercentLiteralDelimiters:
17
- PreferredDelimiters:
18
- '%w': '()'
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.6.5
4
- - 2.7.0
3
+ - 2.6.6
4
+ - 2.7.2
5
5
  script:
6
6
  - bundle exec rubocop
7
7
  - bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.0
4
+
5
+ - Implement [Bot API 5.1](https://core.telegram.org/bots/api#march-9-2021)
6
+
3
7
  ## 0.14.0
4
8
 
5
9
  - Implement [Bot API 5.0](https://core.telegram.org/bots/api#november-4-2020)
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(--force-exclusion)
9
- task.patterns = %w(lib/**/*.rb)
8
+ task.options = %w[--force-exclusion]
9
+ task.patterns = %w[lib/**/*.rb]
10
10
  task.requires << 'rubocop-rspec'
11
11
  end
12
12
 
@@ -1,7 +1,7 @@
1
1
  module Telegram
2
2
  module Bot
3
3
  class Api # rubocop:disable ClassLength
4
- ENDPOINTS = %w(
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
@@ -19,8 +19,9 @@ module Telegram
19
19
  sendGame setGameScore getGameHighScores setPassportDataErrors
20
20
  editMessageMedia sendAnimation sendPoll stopPoll setChatPermissions
21
21
  setChatAdministratorCustomTitle sendDice getMyCommands setMyCommands
22
- setStickerSetThumb logOut close copyMessage
23
- ).freeze
22
+ setStickerSetThumb logOut close copyMessage createChatInviteLink
23
+ editChatInviteLink revokeChatInviteLink
24
+ ].freeze
24
25
  REPLY_MARKUP_TYPES = [
25
26
  Telegram::Bot::Types::ReplyKeyboardMarkup,
26
27
  Telegram::Bot::Types::ReplyKeyboardRemove,
@@ -31,16 +31,20 @@ module Telegram
31
31
  return unless response['ok']
32
32
 
33
33
  response['result'].each do |data|
34
- update = Types::Update.new(data)
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
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
@@ -1,11 +1,9 @@
1
1
  module Telegram
2
2
  module Bot
3
3
  class NullLogger < Logger
4
- def initialize(*)
5
- end
4
+ def initialize(*); end
6
5
 
7
- def add(*)
8
- end
6
+ def add(*); end
9
7
  end
10
8
  end
11
9
  end
@@ -73,11 +73,14 @@ require 'telegram/bot/types/inline_query_result_video'
73
73
  require 'telegram/bot/types/inline_query_result_voice'
74
74
  require 'telegram/bot/types/chosen_inline_result'
75
75
  require 'telegram/bot/types/proximity_alert_triggered'
76
+ require 'telegram/bot/types/voice_chat_started'
77
+ require 'telegram/bot/types/voice_chat_ended'
78
+ require 'telegram/bot/types/voice_chat_participants_invited'
79
+ require 'telegram/bot/types/message_auto_delete_timer_changed'
76
80
  require 'telegram/bot/types/message'
77
81
  require 'telegram/bot/types/callback_query'
78
82
  require 'telegram/bot/types/shipping_query'
79
83
  require 'telegram/bot/types/pre_checkout_query'
80
- require 'telegram/bot/types/update'
81
84
  require 'telegram/bot/types/keyboard_button_poll_type'
82
85
  require 'telegram/bot/types/keyboard_button'
83
86
  require 'telegram/bot/types/reply_keyboard_markup'
@@ -86,7 +89,10 @@ require 'telegram/bot/types/force_reply'
86
89
  require 'telegram/bot/types/file'
87
90
  require 'telegram/bot/types/labeled_price'
88
91
  require 'telegram/bot/types/shipping_option'
92
+ require 'telegram/bot/types/chat_invite_link'
89
93
  require 'telegram/bot/types/chat_member'
94
+ require 'telegram/bot/types/chat_member_updated'
95
+ require 'telegram/bot/types/update'
90
96
  require 'telegram/bot/types/user_profile_photos'
91
97
  require 'telegram/bot/types/input_media_photo'
92
98
  require 'telegram/bot/types/input_media_video'
@@ -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
@@ -7,9 +7,11 @@ module Telegram
7
7
  attribute :custom_title, String
8
8
  attribute :is_anonymous, Boolean
9
9
  attribute :can_be_edited, Boolean
10
+ attribute :can_manage_chat, Boolean
10
11
  attribute :can_post_messages, Boolean
11
12
  attribute :can_edit_messages, Boolean
12
13
  attribute :can_delete_messages, Boolean
14
+ attribute :can_manage_voice_chats, Boolean
13
15
  attribute :can_restrict_members, Boolean
14
16
  attribute :can_promote_members, Boolean
15
17
  attribute :can_change_info, Boolean
@@ -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
@@ -44,6 +44,7 @@ module Telegram
44
44
  attribute :group_chat_created, Boolean
45
45
  attribute :supergroup_chat_created, Boolean
46
46
  attribute :channel_chat_created, Boolean
47
+ attribute :message_auto_delete_timer_changed, MessageAutoDeleteTimerChanged
47
48
  attribute :migrate_to_chat_id, Integer
48
49
  attribute :migrate_from_chat_id, Integer
49
50
  attribute :pinned_message, Message
@@ -52,6 +53,9 @@ module Telegram
52
53
  attribute :connected_website, String
53
54
  attribute :passport_data, PassportData
54
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
55
59
  attribute :reply_markup, InlineKeyboardMarkup
56
60
 
57
61
  alias to_s text
@@ -0,0 +1,9 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class MessageAutoDeleteTimerChanged < Base
5
+ attribute :message_auto_delete_time, Integer
6
+ end
7
+ end
8
+ end
9
+ end
@@ -14,6 +14,8 @@ module Telegram
14
14
  attribute :pre_checkout_query, PreCheckoutQuery
15
15
  attribute :poll, Poll
16
16
  attribute :poll_answer, PollAnswer
17
+ attribute :my_chat_member, ChatMemberUpdated
18
+ attribute :chat_member, ChatMemberUpdated
17
19
 
18
20
  def current_message
19
21
  @current_message ||=
@@ -0,0 +1,9 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class VoiceChatEnded < Base
5
+ attribute :duration, Integer
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class VoiceChatParticipantsInvited < Base
5
+ attribute :users, Array[User]
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class VoiceChatStarted < Base
5
+ end
6
+ end
7
+ end
8
+ end
@@ -1,5 +1,5 @@
1
1
  module Telegram
2
2
  module Bot
3
- VERSION = '0.14.0'.freeze
3
+ VERSION = '0.15.0'.freeze
4
4
  end
5
5
  end
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.14.0
4
+ version: 0.15.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: 2020-11-05 00:00:00.000000000 Z
11
+ date: 2021-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -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,8 +156,10 @@ 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
160
  - lib/telegram/bot/types/chat_location.rb
161
161
  - lib/telegram/bot/types/chat_member.rb
162
+ - lib/telegram/bot/types/chat_member_updated.rb
162
163
  - lib/telegram/bot/types/chat_permissions.rb
163
164
  - lib/telegram/bot/types/chat_photo.rb
164
165
  - lib/telegram/bot/types/chosen_inline_result.rb
@@ -213,6 +214,7 @@ files:
213
214
  - lib/telegram/bot/types/login_url.rb
214
215
  - lib/telegram/bot/types/mask_position.rb
215
216
  - lib/telegram/bot/types/message.rb
217
+ - lib/telegram/bot/types/message_auto_delete_timer_changed.rb
216
218
  - lib/telegram/bot/types/message_entity.rb
217
219
  - lib/telegram/bot/types/order_info.rb
218
220
  - lib/telegram/bot/types/passport_data.rb
@@ -247,13 +249,16 @@ files:
247
249
  - lib/telegram/bot/types/video.rb
248
250
  - lib/telegram/bot/types/video_note.rb
249
251
  - lib/telegram/bot/types/voice.rb
252
+ - lib/telegram/bot/types/voice_chat_ended.rb
253
+ - lib/telegram/bot/types/voice_chat_participants_invited.rb
254
+ - lib/telegram/bot/types/voice_chat_started.rb
250
255
  - lib/telegram/bot/types/webhook_info.rb
251
256
  - lib/telegram/bot/version.rb
252
257
  - telegram-bot-ruby.gemspec
253
258
  homepage: https://github.com/atipugin/telegram-bot
254
259
  licenses: []
255
260
  metadata: {}
256
- post_install_message:
261
+ post_install_message:
257
262
  rdoc_options: []
258
263
  require_paths:
259
264
  - lib
@@ -268,8 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
273
  - !ruby/object:Gem::Version
269
274
  version: '0'
270
275
  requirements: []
271
- rubygems_version: 3.1.4
272
- signing_key:
276
+ rubygems_version: 3.2.3
277
+ signing_key:
273
278
  specification_version: 4
274
279
  summary: Ruby wrapper for Telegram's Bot API
275
280
  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