lib/telegram/bot/updates_controller.rb in telegram-bot-0.14.3 vs lib/telegram/bot/updates_controller.rb in telegram-bot-0.14.4
- old
+ new
@@ -95,10 +95,12 @@
inline_query
chosen_inline_result
callback_query
shipping_query
pre_checkout_query
+ poll
+ poll_answer
].freeze
class << self
# Initialize controller and process update.
def dispatch(*args)
@@ -146,11 +148,11 @@
end
# Accessor to `'from'` field of payload. Can be overriden with `from` option
# for #initialize.
def from
- @_from ||= payload && payload['from']
+ @_from ||= payload.is_a?(Hash) ? payload['from'] : payload.try(:from)
end
# Processes current update.
def dispatch
action, args = action_for_payload
@@ -202,9 +204,13 @@
[payload_type, [payload['result_id'], payload['query']]]
end
def action_for_callback_query
[payload_type, [payload['data']]]
+ end
+
+ def action_for_poll_answer
+ [payload_type, [payload['poll_id'], payload['option_ids']]]
end
# Silently ignore unsupported messages to not fail when user crafts
# an update with usupported command, callback query context, etc.
def action_missing(action, *_args)