lib/messenger/bot/receiver.rb in messenger-bot-0.1.6 vs lib/messenger/bot/receiver.rb in messenger-bot-0.1.7
- old
+ new
@@ -2,14 +2,14 @@
module Bot
class Receiver
def self.share(data)
messaging_events = data["entry"].first["messaging"]
messaging_events.each_with_index do |event, key|
- if event["message"]
+ if event["message"] && !defined?(message).nil?
self.class.send(:message, event)
- elsif event["postback"]
+ elsif event["postback"] && !defined?(postback).nil?
self.class.send(:postback, event)
- elsif event["delivery"]
+ elsif event["delivery"] && !defined?(delivery).nil?
self.class.send(:delivery, event)
end
end
end