lib/telegram/bot/client.rb in telegram-bot-ruby-0.4.2 vs lib/telegram/bot/client.rb in telegram-bot-ruby-0.5.0.beta1

- old
+ new

@@ -1,11 +1,8 @@ module Telegram module Bot class Client - TIMEOUT_EXCEPTIONS = [Timeout::Error] - TIMEOUT_EXCEPTIONS << Net::ReadTimeout if Net.const_defined?(:ReadTimeout) - attr_reader :api, :offset, :timeout attr_accessor :logger def self.run(*args, &block) new(*args).run(&block) @@ -40,21 +37,24 @@ @offset = update.update_id.next message = extract_message(update) log_incoming_message(message) yield message end - rescue *TIMEOUT_EXCEPTIONS + rescue Faraday::TimeoutError retry end private def default_options { offset: 0, timeout: 20, logger: NullLogger.new } end def extract_message(update) - update.inline_query || update.chosen_inline_result || update.message + update.inline_query || + update.chosen_inline_result || + update.callback_query || + update.message end def log_incoming_message(message) logger.info( format('Incoming message: text="%s" uid=%i', message, message.from.id)