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."},
{"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."},
{"?","?"}
}}

View File

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

View File

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