Class: MWIRC::Bot

Inherits:
Object
  • Object
show all
Defined in:
lib/mw-irc.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Bot

Returns a new instance of Bot.



6
7
8
9
10
# File 'lib/mw-irc.rb', line 6

def initialize(opts={})
  raise 'host and port must be specified' if opts[:port].nil? || opts[:host].nil?
  @host = opts[:host]
  @port = opts[:port]
end

Class Method Details

.send(text, host, port) ⇒ Object



17
18
19
20
# File 'lib/mw-irc.rb', line 17

def self.send(text, host, port)
  @sock = UDPSocket.open if @sock.nil?
  @sock.send text, 0, host, port
end

Instance Method Details

#send(text) ⇒ Object



12
13
14
15
# File 'lib/mw-irc.rb', line 12

def send(text)
  raise 'no host or port were specified' if @host.nil? || @port.nil?
  MWIRC::Bot.send(text, @host, @port)
end