1 import irc, strutils, tables, times, threadpool, net
2 import config, commands, buildsys
4 var refreshTime: float = epochTime() + 100.0
6 var client = newIrc(ircHost, ircPort.Port,
7 nick = ircNick, user = ircNick, realname = ircNick,
8 joinChans = @[ircChannel])
12 checkBuildFinished(client)
14 if epochTime() > refreshTime:
16 checkServerChanges(client)
18 checkRebuildNeeded(client)
19 refreshTime = epochTime() + masterRefreshTime
22 if client.poll(event, 100):
26 of EvDisconnected, EvTimeout:
29 if event.cmd == MPrivMsg:
30 checkMemos(client, event)
31 let msg = event.params[event.params.high]
32 if msg.startsWith(".:") and msg.len > 2:
33 let argv = msg[2 .. ^1].splitWhitespace()
35 let args = argv[1 .. ^1].join(" ")
36 if cmd in botCommands:
37 echo("command: ", cmd, " ", args)
38 botCommands[cmd](client, event, args)