lib/telegram/bot/updates_controller.rb in telegram-bot-0.13.0 vs lib/telegram/bot/updates_controller.rb in telegram-bot-0.13.1

- old
+ new

@@ -155,10 +155,17 @@ # Accessor to `'chat'` field of payload. Also tries `'chat'` in `'message'` # when there is no such field in payload. # # Can be overriden with `chat` option for #initialize. def chat - @_chat ||= payload.try! { |x| x['chat'] || x['message'] && x['message']['chat'] } + @_chat ||= + if payload + if payload.is_a?(Hash) + payload['chat'] || payload['message'] && payload['message']['chat'] + else + payload.try(:chat) || payload.try(:message).try!(:chat) + end + end end # Accessor to `'from'` field of payload. Can be overriden with `from` option # for #initialize. def from