Class: WitBot::Bot::Message

Inherits:
Message
  • Object
show all
Defined in:
lib/wit_bot/bot/models/message.rb

Instance Attribute Summary

Attributes inherited from Message

#_outcomes, #_text, #id, #meta, #outcomes, #sent, #text, #thread

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

#==, #initialize, many_from_hash, #outcome, #params, #parse_outcomes, #parse_outcomes!, #to_hash

Constructor Details

This class inherits a constructor from WitBot::Message

Class Method Details

.from_hash(thread, id, json) ⇒ Object



11
12
13
# File 'lib/wit_bot/bot/models/message.rb', line 11

def self.from_hash(thread, id, json)
  self.new(thread, json[:text], id: id).from_hash json
end

Instance Method Details

#bot?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/wit_bot/bot/models/message.rb', line 4

def bot?
  true
end

#from_hash(json) ⇒ Object



7
8
9
10
# File 'lib/wit_bot/bot/models/message.rb', line 7

def from_hash(json)
  @_text = json[:_text]
  self
end

#sendObject



14
15
16
# File 'lib/wit_bot/bot/models/message.rb', line 14

def send
  throw "You can't send a bot message."
end