Class: Ircnotify::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/ircnotify/notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(message, verbose = false) ⇒ Notifier

Returns a new instance of Notifier.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ircnotify/notifier.rb', line 3

def initialize message, verbose=false
  @bot = ::Cinch::Bot.new do
    self.loggers = NullLogger.new if not verbose
    configure do |c|
      # TODO FIXME
      # this doesn't handle all nested config options!
      # see https://github.com/cinchrb/cinch/blob/master/docs/bot_options.md
      IRC_CONF.each do |key,val|
        if key != "ssl"
          c.send :"#{key}=", val
        else
          val.each do |k,v|
            c.ssl.send :"#{k}=",v
          end
        end

      end
    end

    on :join do |m, channel|
      m.reply message
      @bot.quit "Message delivered"
    end
  end
end

Instance Method Details

#notifyObject



29
30
31
# File 'lib/ircnotify/notifier.rb', line 29

def notify
  @bot.start
end