1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-03 17:55:52 +03:00

Fix poller for typed responses

Fixes: #22
Этот коммит содержится в:
Max Melentiev
2017-03-05 17:54:14 +03:00
родитель 17260cb5a9
Коммит 48ff7a4f43
5 изменённых файлов: 45 добавлений и 8 удалений

Просмотреть файл

@@ -65,14 +65,16 @@ module Telegram
def fetch_updates
response = bot.async(false) { bot.get_updates(offset: offset, timeout: timeout) }
return unless response['ok'] && response['result'].any?
updates = response.is_a?(Array) ? response : response['result']
return unless updates && updates.any?
reload! do
response['result'].each do |update|
updates.each do |update|
@offset = update['update_id'] + 1
yield update
end
end
rescue Timeout::Error # rubocop:disable HandleExceptions
rescue Timeout::Error
log { 'Fetch timeout' }
end
def reload!

Просмотреть файл

@@ -1,6 +1,6 @@
module Telegram
module Bot
VERSION = '0.11.0'.freeze
VERSION = '0.11.1'.freeze
def self.gem_version
Gem::Version.new VERSION