Class: Dickburt::Message

Inherits:
Map
  • Object
show all
Defined in:
lib/dickburt/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject

Returns the value of attribute args.



4
5
6
# File 'lib/dickburt/message.rb', line 4

def args
  @args
end

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/dickburt/message.rb', line 3

def command
  @command
end

Instance Method Details

#process_commandObject



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

#userObject



22
23
24
# File 'lib/dickburt/message.rb', line 22

def user
  
end