lib/telegram/bot/client.rb in telegram-bot-ruby-0.14.0 vs lib/telegram/bot/client.rb in telegram-bot-ruby-0.15.0
- old
+ new
@@ -29,17 +29,21 @@
def fetch_updates
response = api.getUpdates(options)
return unless response['ok']
response['result'].each do |data|
- update = Types::Update.new(data)
- @options[:offset] = update.update_id.next
- message = update.current_message
- log_incoming_message(message)
- yield message
+ yield handle_update(Types::Update.new(data))
end
rescue Faraday::TimeoutError
retry
+ end
+
+ def handle_update(update)
+ @options[:offset] = update.update_id.next
+ message = update.current_message
+ log_incoming_message(message)
+
+ message
end
private
def default_options