class Bobot::Event::Message
Constants
- ATTACHMENT_TYPES
Public Instance Methods
app_id()
click to toggle source
# File lib/bobot/events/message.rb, line 32 def app_id @messaging['message']['app_id'] end
attachment_type()
click to toggle source
# File lib/bobot/events/message.rb, line 42 def attachment_type return if attachments.nil? attachments.first['type'] end
attachment_url()
click to toggle source
# File lib/bobot/events/message.rb, line 48 def attachment_url return if attachments.nil? return unless %w[image audio video file].include? attachment_type attachments.first['payload']['url'] end
attachments()
click to toggle source
# File lib/bobot/events/message.rb, line 24 def attachments @messaging['message']['attachments'] end
echo?()
click to toggle source
# File lib/bobot/events/message.rb, line 20 def echo? @messaging['message']['is_echo'].present? end
id()
click to toggle source
# File lib/bobot/events/message.rb, line 8 def id @messaging['message']['mid'] end
location_coordinates()
click to toggle source
# File lib/bobot/events/message.rb, line 55 def location_coordinates return [] unless attachment_type?('location') coordinates_data = attachments.first['payload']['coordinates'] [coordinates_data['lat'], coordinates_data['long']] end
nlp()
click to toggle source
# File lib/bobot/events/message.rb, line 28 def nlp @messaging['message']['nlp'] end
quick_reply()
click to toggle source
# File lib/bobot/events/message.rb, line 62 def quick_reply return unless @messaging['message']['quick_reply'] @messaging['message']['quick_reply']['payload'] end
Also aliased as: payload
seq()
click to toggle source
# File lib/bobot/events/message.rb, line 12 def seq @messaging['message']['seq'] end
text()
click to toggle source
# File lib/bobot/events/message.rb, line 16 def text @messaging['message']['text'] end
Private Instance Methods
attachment_type?(attachment_type)
click to toggle source
# File lib/bobot/events/message.rb, line 71 def attachment_type?(attachment_type) !attachments.nil? && attachments.first['type'] == attachment_type end