Class: Daneel::Scripts::Help

Inherits:
Daneel::Script show all
Defined in:
lib/daneel/scripts/help.rb

Instance Attribute Summary

Attributes inherited from Plugin

#robot

Instance Method Summary collapse

Methods inherited from Daneel::Script

#accepts?, files, inherited, list

Methods inherited from Plugin

#initialize, #logger, requires_env

Constructor Details

This class inherits a constructor from Daneel::Plugin

Instance Method Details

#helpObject



16
17
18
# File 'lib/daneel/scripts/help.rb', line 16

def help
  {"help" => "show this help summary"}
end

#receive(room, message, user) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/daneel/scripts/help.rb', line 7

def receive(room, message, user)
  case message.command
  when /help$/
    col = helps.keys.map(&:length).max + 2
    room.say helps.map{|k,v| "%-#{col}s %s" % [k,v] }.sort.join("\n")
    message.done!
  end
end