lib/telegram/bot/client.rb in telegram-bot-ruby-0.18.0 vs lib/telegram/bot/client.rb in telegram-bot-ruby-0.19.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Telegram
module Bot
class Client
attr_reader :api, :options
attr_accessor :logger
@@ -31,11 +33,11 @@
return unless response['ok']
response['result'].each do |data|
yield handle_update(Types::Update.new(data))
end
- rescue Faraday::TimeoutError
+ rescue Faraday::TimeoutError, Faraday::ConnectionFailed
retry
end
def handle_update(update)
@options[:offset] = update.update_id.next
@@ -48,19 +50,18 @@
private
def default_options
{
offset: 0,
- timeout: 20,
logger: NullLogger.new,
url: 'https://api.telegram.org'
}
end
def log_incoming_message(message)
uid = message.respond_to?(:from) && message.from ? message.from.id : nil
logger.info(
- format('Incoming message: text="%s" uid=%s', message, uid)
+ format('Incoming message: text="%<text>s" uid=%<uid>s', message: message, uid: uid)
)
end
end
end
end