Class: Cinch::Plugins::Deploy

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/deploy.rb

Instance Method Summary collapse

Instance Method Details

#listen(m) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cinch/plugins/deploy.rb', line 8

def listen(m)
  return if @running
  @running = true
  config[:configurations].each do |config|
    if config[:channels].include?(m.channel.to_s) and config[:users].include?(m.user.nick) and m.message =~ Regexp.new(config[:trigger])
      IO.popen(config[:command]) do |handle|
        while line = handle.gets
          m.reply line, true
        end
      end
    else
      m.reply "ch:#{m.channel.to_s} usr:#{m.user.nick} msg:#{m.message}", true
    end
  end
  @running = nil
end