lib/telegram/bot/updates_poller.rb in telegram-bot-0.11.0 vs lib/telegram/bot/updates_poller.rb in telegram-bot-0.11.1

- old
+ new

@@ -63,17 +63,19 @@ @running = false end 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! return yield unless reload reloading_code do