All pastes #523286 Raw Edit

Someone

public text v1 · immutable
#523286 ·published 2007-05-30 19:02 UTC
rendered paste body
--Load socket library
require("socket")

--A few needed vars
hostname = "irc.gamesurge.net"
port = 6667
channel = "#luahelp"
nick = "Xeno"
user = "Xeno . . :XenoBot"

--Create connection object
irc = socket.tcp()

function Connect()
	local sock, err = irc:connect(hostname,port)
	irc:send("USER "..user)
	irc:send("NICK "..nick)
	local response = irc:receive("*l")
	print(string.gsub(response,"NOTICE AUTH :*** ",""))
	response = irc:receive("*l")
	print(string.gsub(response,"NOTICE AUTH :*** ",""))
	response = irc:receive("*l")
	print(string.gsub(response,"NOTICE AUTH :*** ",""))
	response = irc:receive("*l")
	print(response)
	ping = string.gsub(response,"PING :","PONG :")
	irc:send(ping)
	Perform()
end

function Perform()
	irc:send("JOIN "..channel)
	Say("Hey guys")
end

function Say(msg)
	irc:send("PRIVMSG "..channel.." :"..msg)
end

while(true) do
	Connect()
end