Hopefully last change to the high-five catcher

This commit is contained in:
Izaya 2016-01-08 00:57:42 +11:00
parent 77be29f362
commit b70d0eaa20
2 changed files with 15 additions and 6 deletions

View File

@ -1 +1 @@
{server="irc.quakenet.org",nick="yukichan",hostname="lain",servername="lain",realname="yuki",channels={"#SKSDev","#v","#ssss"},prefix=":",username="yuki",port=6667,admins={"ShadowKatStudios"}} {server="irc.esper.net",nick="yukichan",hostname="lain",servername="lain",realname="yuki",channels={"#SKSDev","#v","#ssss"},prefix=":",username="yuki",port=6667,admins={"ShadowKatStudios"}}

View File

@ -64,8 +64,12 @@ leftHanging = {0,false}
function parsemsg(nick,chan,message) function parsemsg(nick,chan,message)
if message:find("o/") ~= nil or message:find("\\o") ~= nil and nick ~= "Shocky" and nick ~= "yukichan" then if message:find("o/") ~= nil or message:find("\\o") ~= nil and nick ~= "Shocky" and nick ~= "yukichan" then
if leftHanging[2] == false then if leftHanging[2] == false then
print ("Left hanging at "..os.time()) print (nick .." left hanging at "..os.time())
leftHanging = {os.time(),true,chan} local typeOfHighFive="o/"
if message:find("o/") ~= nil then
typeOfHighFive = "\\o"
end
leftHanging = {os.time(),true,chan,typeOfHighFive}
elseif leftHanging[2] == true then elseif leftHanging[2] == true then
leftHanging = {0,false} leftHanging = {0,false}
print("No longer left hanging.") print("No longer left hanging.")
@ -153,9 +157,14 @@ function main()
connection:send("NICK "..config.nick.."\n") connection:send("NICK "..config.nick.."\n")
connection:send("USER "..config.username.." "..config.hostname.." "..config.servername.." "..config.realname.."\n") connection:send("USER "..config.username.." "..config.hostname.." "..config.servername.." "..config.realname.."\n")
repeat repeat
line = connection:receive() line = connection:receive() or ""
if string.find(line, "PING :") == 1 then
local _,pingid = string.match(line,"([^,]+):([^,]+)")
writeln("PONG :"..pingid)
print("Pinged: "..pingid)
end
print(line) print(line)
until string.match(line,"%+i") ~= false until string.match(line or "","%+i") ~= nil
os.sleep(2) os.sleep(2)
print("Sent everything relevant. Joining channels.") print("Sent everything relevant. Joining channels.")
for k,v in pairs(config.channels) do for k,v in pairs(config.channels) do
@ -169,7 +178,7 @@ function main()
end end
if os.time() > leftHanging[1]+3 and leftHanging[2] then if os.time() > leftHanging[1]+3 and leftHanging[2] then
print ("Responding to a hanging high-five at "..leftHanging[1]) print ("Responding to a hanging high-five at "..leftHanging[1])
sendchan(leftHanging[3],"\\o") sendchan(leftHanging[3],leftHanging[4] or "\\o")
leftHanging={0,false} leftHanging={0,false}
end end
if line == nil then line = "" end if line == nil then line = "" end