Class: Ircbot

Inherits:
Object
  • Object
show all
Defined in:
lib/post2irc/ircbot.rb

Class Method Summary collapse

Class Method Details

.report(message) ⇒ Object



19
20
21
22
23
# File 'lib/post2irc/ircbot.rb', line 19

def self.report(message)
    @@channels.each do |cname|
        @@bot.Channel(cname).send "#{message}"
    end
end

.start(server, port, channels, nickname) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/post2irc/ircbot.rb', line 2

def self.start(server, port, channels, nickname)
    @@channels = channels.split(',')
    @@bot = Cinch::Bot.new do
      configure do |c|
        c.nick = nickname
        c.user = nickname
        c.realname = nickname
        c.server = server
        c.port = port
        c.channels = @@channels
      end
    end
    Thread.new do
      @@bot.start
    end
end