Class: Dickburt::Message
- Inherits:
-
Map
- Object
- Map
- Dickburt::Message
- Defined in:
- lib/dickburt/message.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#command ⇒ Object
Returns the value of attribute command.
Instance Method Summary collapse
-
#initialize(json) ⇒ Message
constructor
A new instance of Message.
- #process_command ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(json) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 11 |
# File 'lib/dickburt/message.rb', line 6 def initialize(json) super(JSON.parse(json)) puts self.inspect puts "="*45 self end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
4 5 6 |
# File 'lib/dickburt/message.rb', line 4 def args @args end |
#command ⇒ Object
Returns the value of attribute command.
3 4 5 |
# File 'lib/dickburt/message.rb', line 3 def command @command end |
Instance Method Details
#process_command ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/dickburt/message.rb', line 13 def process_command return unless @command # TODO make dickburt aware of users so he can respond to them. # I really don't like this setup of not having instances of the bot. # If i got an instance I could save things to it, like the user and message object # Then it wouldn't be as weird to process the command here on the message object @args ? Dickburt::Bot.send(@command, @args) : Dickburt::Bot.send(@command) end |
#user ⇒ Object
22 23 24 |
# File 'lib/dickburt/message.rb', line 22 def user end |