Updated ai.lua, attempted to add a timeout mechanism (it doesn't work)

This commit is contained in:
Izaya 2016-01-14 16:19:05 +11:00
parent 8021d11dd2
commit 17f1d09e76
3 changed files with 20 additions and 6 deletions

3
ai.lua
View File

@ -5,6 +5,9 @@
{"I really like Queens of the Stone Age","Paramore is pretty good.","Green Day is great to listen to."}, {"I really like Queens of the Stone Age","Paramore is pretty good.","Green Day is great to listen to."},
{"music","favorite","like","?"} {"music","favorite","like","?"}
},{ },{
{"tsunbot a shit","tsunbot should pull a ThatAnon","tsunbot should self-terminate."},
{"tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot",}
},{
{"Yes.","No.","Perhaps."}, {"Yes.","No.","Perhaps."},
{"?","?"} {"?","?"}
}} }}

View File

@ -1,5 +1,5 @@
{server="irc.quakenet.org", {server="irc.freenode.net",
nick="yukichan", nick="yukichan2",
hostname="lain", hostname="lain",
servername="lain", servername="lain",
realname="yuki", realname="yuki",
@ -20,7 +20,7 @@ timers={
"highfive.lua" "highfive.lua"
}, },
debug=false, debug=false,
autojoin=true, autojoin=false,
prefix=":", prefix=":",
username="yuki", username="yuki",
port=6667, port=6667,

View File

@ -152,6 +152,14 @@ function parsemsg(nick,chan,message)
sendchan(chan,"Bye! o/") sendchan(chan,"Bye! o/")
writeln("QUIT :Blame telstra.") writeln("QUIT :Blame telstra.")
print("Killed by "..nick) print("Killed by "..nick)
os.exit(0)
end
elseif tCommand[1] == "restart" then
if checkAdmin(nick) then
sendchan(chan,"Bye! o/")
writeln("QUIT :Blame telstra.")
print("Killed by "..nick)
os.exit(1)
end end
elseif cmds[tCommand[1]] ~= nil then elseif cmds[tCommand[1]] ~= nil then
local fail, errors = pcall(cmds[tCommand[1]],nick,chan,tCommand,message) local fail, errors = pcall(cmds[tCommand[1]],nick,chan,tCommand,message)
@ -229,9 +237,12 @@ function main()
if line ~= nil and line ~= "timeout" then if line ~= nil and line ~= "timeout" then
print(line) print(line)
pcall(parse,line) pcall(parse,line)
elseif line == "timeout" and os.time() > _G.lastping + config.timeout then else
print("Connection to IRC timed out, aborting.") --[[ if (line == "timeout" or line == nil) and os.time() > _G.lastping + config.timeout then
break print(line)
print("Connection to IRC timed out, aborting.")
os.exit(1)
end]]--
end end
for k,v in ipairs(timers) do for k,v in ipairs(timers) do
local fail, errors = pcall(v,line) local fail, errors = pcall(v,line)