Hi there, I recently started with Ruby and I am trying to make a very
simple irc bot, but I am having some slight problems though.
This is what I came up with:
require 'socket'
class Irc
def connect(server, port = 6667)
@socket = TCPsocket.new(server, port)
end
def to_server(text)
@socket.gets(text)
return true
end
def from_server()
return @socket.puts
end
end
irc = Irc.new
irc.connect("irc.homelien.no", 6667)
irc.to_server('NICK: testbot')
irc.to_server('USER: testbot "" "irc.efnet.net" :testbot')
go = true
while go == true
if (text = irc.from_server)
puts(text)
end
end
Doesn't work though, I just get the loop.
···
--
Posted via http://www.ruby-forum.com/.