Module: Bender::IrcListener

Defined in:
lib/irc_listener.rb

Overview

Handles SpunkBot Processors and auto-mounting them

Author

Michael Heijmans ([email protected])

Copyright

Copyright © 2013-2015 Michael Heijmans

License

MIT

Class Method Summary collapse

Class Method Details

.start(bot) ⇒ Object

Loads all the IRC text processors


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/irc_listener.rb', line 11

def self.start(bot)
  @bot = bot
  begin
    Bender.log.info("Starting irc processors.")
    Bender::Processor.constants.each do |i|
      @bot.add_processor( eval "Bender::Processor::#{i.to_s}.new" )
      Bender.log.info "  Starting processor: #{i.to_s}"
    end
    @bot.start
  rescue => e
    Bender.log.error "IRC processor caught execption"
    Bender.log.error e
    raise e
  ensure
    Bender.log.info("IRC processors shutting down...")
  end
end