Class: Ruboty::Hubot::Actions::Respond

Inherits:
Actions::Base
  • Object
show all
Extended by:
Mem
Defined in:
lib/ruboty/hubot/actions/respond.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.robotObject



14
15
16
17
18
# File 'lib/ruboty/hubot/actions/respond.rb', line 14

def robot
  robot = Robot.new
  scripts.each {|script| robot.load_script script }
  robot
end

.scriptsObject



8
9
10
11
12
# File 'lib/ruboty/hubot/actions/respond.rb', line 8

def scripts
  Dir.glob(File.join(Dir.pwd, 'scripts/*')).map do |path|
    Script.new(path)
  end
end

Instance Method Details

#callObject



22
23
24
25
26
# File 'lib/ruboty/hubot/actions/respond.rb', line 22

def call
  self.class.robot.receive(message.body) do |res|
    message.reply("@#{message.from_name} #{res}")
  end
end