lib/telegram/bot/client.rb in telegram-bot-ruby-0.8.3 vs lib/telegram/bot/client.rb in telegram-bot-ruby-0.8.4
- old
+ new
@@ -31,11 +31,11 @@
return unless response['ok']
response['result'].each do |data|
update = Types::Update.new(data)
@options[:offset] = update.update_id.next
- message = extract_message(update)
+ message = update.current_message
log_incoming_message(message)
yield message
end
rescue Faraday::Error::TimeoutError
retry
@@ -43,20 +43,9 @@
private
def default_options
{ offset: 0, timeout: 20, logger: NullLogger.new }
- end
-
- def extract_message(update)
- types = %w(inline_query
- chosen_inline_result
- callback_query
- edited_message
- message
- channel_post
- edited_channel_post)
- types.inject(nil) { |acc, elem| acc || update.public_send(elem) }
end
def log_incoming_message(message)
uid = message.from ? message.from.id : nil
logger.info(