forked from shrykull/pyhkal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyhkal.py
executable file
·613 lines (567 loc) · 23.5 KB
/
pyhkal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: pykhal.py
import asyncore, asynchat
import re, socket, cPickle, datetime
import sys
import time
from time import strftime
from random import random
from threading import Timer
class IRCBot(asynchat.async_chat):
MODLIST = []
performqueue = []
performfilename = "perform.list"
def __init__(self, server="irc.quakenet.org", port=6667,ident="nexus", password="", nickname="FAiLHKAL", mainchannel="#ich-sucke", createSocket=True):
if createSocket:
asynchat.async_chat.__init__(self)
self.set_terminator("\n")
self.data = ""
self.server = server
self.port = port
self.ident = ident
self.nickname = nickname
self.mainchannel = mainchannel
self.initcommands = [
"USER " + self.ident + " " + self.ident + " " + self.ident + " :Python-TiHKAL",
"PASS " + password,
"NICK " + self.nickname
]
try:
self.performqueue = file2obj(self.performfilename)
except IOError:
self.performqueue = []
obj2file(self.performqueue,self.performfilename)
self.spamqueue = SpamQueue(5,5)
if createSocket:
self.create_socket(socket.AF_INET,socket.SOCK_STREAM)
self.connect((server,port))
def handle_connect(self):
print "(INFO) Connected to ", self.server + ":" + str(self.port)
pass
def handle_expt(self):
print "(INFO) Connection to ", self.server + ":" + str(self.port), "failed."
self.close()
def collect_incoming_data(self, data):
self.data = self.data + data
def found_terminator(self):
data = self.data
if data.endswith("\r"):
data = data[:-1]
self.data = ""
for x in self.MODLIST:
l = re.findall(x.regexpattern,data)
if (l):
try:
x.handleInput(l[0])
except Exception as inst:
self.printErr(str(x),inst)
if re.match("PING :",data):
self.sendraw("PONG " + data.split(" ")[1])
return
if re.match(":(.+) PRIVMSG (.+) :(.+)", data):
self.onText(*re.match(":(.+) PRIVMSG (.+) :(.+)", data).group(1,2,3))
return
if re.match(":(.+) NICK :(.+)",data):
self.onNick(*re.match(":(.+) NICK :(.+)",data).group(1,2))
return
if re.match(":.+ (\d\d\d) (.+)",data):
self.onRawNumeric(*re.match(":.+ (\d+) (.+)",data).group(1,2))
return
if re.match(".*NOTICE .+:.+host.+", data):
for x in self.initcommands:
self.sendraw(x)
return
print "( >> )", data
def addModule(self, constructor,params=None):
if (not params):
module = constructor(self)
else:
module = constructor(self,*params)
self.MODLIST.append(module)
def sendraw(self, string):
if (string):
self.push(string + "\r\n")
def onNick(self,oldhost,newnick):
if (nick(oldhost) == self.nickname):
self.nickname = newnick
print "(NICK)", nick(oldhost), "=>", newnick
def quit(self):
self.sendraw("QUIT :... denn #ich-sucke härter als ihr alle zusammen...")
print "(QUIT)", "Terminating..."
exit()
def onRawNumeric(self,numeric,text):
numeric = int(numeric)
if ((numeric == 376) or (numeric == 422)):
for x in self.performqueue:
self.sendraw(x)
def onText(self, host,target,text):
print "(P>>M)", "<" + host + "@" + target + ">", text
def sendMsg(self,target,text):
string = "PRIVMSG " + target + " :" + text
print "(P<<M)", string
self.spamqueue.add(self.sendraw,[string])
def sendNotice(self,target,text):
string = "NOTICE " + target + " :" + text
print "(P<<N)", string
self.spamqueue.add(self.sendraw,[string])
def sendErr(self,target,inst):
self.sendMsg(target,"err > " + str(type(inst)) + " " + str(inst.args))
def printErr(self,name,inst):
print "err in", name + "> " + str(type(inst)) + " " + str(inst.args)
class SpamQueue(object):
def __init__(self,pertime,initialamount):
self.time = pertime
self.init = initialamount
self.counter = 0
self.queue = []
self.resetter = False
def next(self):
if ((self.queue) and (self.counter < self.init)):
self.counter += 1
self.do(self.queue.pop(0))
self.next()
elif ((self.queue) and (self.counter >= self.init)):
self.do(self.queue.pop(0))
Timer(self.time,self.next,()).start()
elif (not self.queue):
Timer(self.time * 2,self.resetcounter,()).start()
self.resetter = True
def add(self,func,list):
self.queue.append((func,list))
if ((not self.counter) or (self.resetter)):
self.resetter = False
self.next()
def do(self,tuple):
tuple[0](*tuple[1])
def resetcounter(self):
self.resetter = False
if (not self.queue):
self.counter = 0
class IRCBotMod(object):
def __init__(self,head):
self.head = head
class AdminMod(IRCBotMod):
adminhosts = []
storage = {}
regexpattern = r':(.+) (?:PRIVMSG|NOTICE) ([\S]+) :(!do|!py|!pydo|!auth|!rehash|spam\?)(?: (.+)|$)'
def __init__(self,head,adminpass="defaultpass"):
IRCBotMod.__init__(self,head)
self.handleInput = self.handler
self.adminpass = adminpass
def handler(self,matchlist):
host = matchlist[0]
target = matchlist[1] if (matchlist[1] != self.head.nickname) else nick(host)
command = matchlist[2]
text = matchlist[3]
if (command == "!auth") and (text == self.adminpass):
if (host not in self.adminhosts):
if (self.adminhosts != []):
for x in self.adminhosts:
self.head.sendMsg(nick(x),"Master added: New admin is " + host)
self.adminhosts.append(host)
adminNickList = []
for x in self.adminhosts:
adminNickList.append(nick(x))
self.head.sendMsg(target,"Done. Admins: " + str(adminNickList))
if (host in self.adminhosts):
if (command == "!do"):
self.head.sendraw(text)
elif (command == "!py"):
try:
self.head.sendMsg(target,"eval> " + str(eval(text,globals(),self.storage)))
except Exception:
try:
exec text in globals(), self.storage
self.head.sendMsg(target,"exec> Done.")
except Exception as inst:
self.head.sendErr(target,inst)
elif (command == "!pydo"):
try:
for x in eval(text,globals(),self.storage):
exec x in globals(), self.storage
self.head.sendMsg(target,"exec> Done.")
except Exception as inst:
self.head.sendErr(target,inst)
elif (command == "spam?"):
self.head.sendraw("PRIVMSG " + target + " :" + str(len(self.head.spamqueue.queue)) + " items in spamqueue.")
elif (command == "!rehash"):
self.head.sendraw("PRIVMSG " + target + " :Reimporting code...",)
if ("pyhkal" in sys.modules):
sys.modules.pop("pyhkal")
instance = bot
import pyhkal
instance.__class__ = pyhkal.IRCBot
pyhkal.main(instance)
class CubeMod(IRCBotMod):
regexpattern = r':(.+) PRIVMSG ([\S]+) :(.+)'
cubers = []
def __init__(self,head):
IRCBotMod.__init__(self,head)
self.handleInput = self.handler
def handler(self,matchlist):
host = matchlist[0]
target = matchlist[1]
text = matchlist[2]
if target == self.head.mainchannel:
if (text[0:2] == ".3"):
s = re.findall("(\d+)",text)
num = 25
if (len(s) > 1):
num = int(s[1])
if ((num > 50) or (num < 1)):
num = 1
self.head.sendMsg(target,"Try " + self.cubescramble(num))
elif (re.match(r'.*\*cube.*',text)):
x = cubetimer(host)
self.cubers.append(x)
else:
i = 0
for x in self.cubers:
if (host == x.name):
self.head.sendMsg(target,host.split("!")[0] + ": " + x.elapsed())
del self.cubers[i]
i += 1
def cubescramble(self,num):
axis = [["U","D"],["R","L"],["F","B"]]
movemods = ["2","'"]
lastAxis = 5
lastMoveOnLastAxis = 5
blockedAxis = 5
curAxis = 5
curMoveOnCurAxis = 5
scramble = ""
for x in xrange(0,num):
curAxis = rand(0,2)
while (curAxis == blockedAxis):
curAxis = rand(0,2)
if (lastAxis != curAxis):
curMoveOnCurAxis = rand(0,1)
blockedAxis = 5
else:
curMoveOnCurAxis = 1 if (lastMoveOnLastAxis == 0) else 0
blockedAxis = curAxis
lastMoveOnLastAxis = curMoveOnCurAxis
lastAxis = curAxis
scramble += axis[curAxis][curMoveOnCurAxis]
if (rand(0,1)):
scramble += movemods[rand(0,1)]
scramble += " "
return scramble
class cubetimer(object):
def __init__(self,name):
self.dt = datetime.datetime.now()
self.name = name
def elapsed(self):
r = str(datetime.datetime.now() - self.dt)
while ((r[0] == "0") or (r[0] == ":")):
r = r[1:]
return r[0:-3]
class DecideMod(IRCBotMod):
regexpattern = r':(.+) PRIVMSG ([\S]+) :!decide (.+)'
def __init__(self,head):
IRCBotMod.__init__(self,head)
self.handleInput = self.handler
def handler(self,matchlist):
self.head.sendMsg(matchlist[1],"Du solltest dich " +
self.regexdecide(list2string(matchlist[2:]),
num=asciicount("*!*" + ident(matchlist[0]))) +
" entscheiden.")
def regexdecide(self,text, num):
matchlist = sorted(re.findall(r'(".+?"|(?<!").+?(?!"))(?:\s|$)',text))
c = asciicount(text) + asciicount(strftime("%d/%m/%Y"))
if len(matchlist) > 1:
return "für " + matchlist[(c + (num % 100)) % len(matchlist)]
else:
if ((c % (num % 100)) % 2 + 1) == 1:
return "dafür"
else:
return "dagegen"
class KarmaMod(IRCBotMod):
regexpattern = r':(.+) PRIVMSG ([\S]+) :(.+)'
filename = "karma.dict"
def __init__(self,head):
IRCBotMod.__init__(self,head)
self.handleInput = self.handler
try:
self.karmadict = file2obj(self.filename)
except IOError:
self.karmadict = {}
def handler(self,matchlist):
if (matchlist[1] == self.head.mainchannel):
karmalist = re.findall(r'(\S\S+\+\+)(?:\s|$)|([\S]\S+--)(?:\s|$)|(\S\S+==)(?:\s|$)',matchlist[2])
for x in karmalist:
if x[0]:
if not x[0][:-2] in self.karmadict:
e = KarmaEntry(x[0][:-2])
self.karmadict[x[0][:-2]] = e
if not self.karmadict[x[0][:-2]].add(1):
self.head.sendMsg(matchlist[1],"Karmaspam - " + x[0][:-2] + " ist noch " + self.karmadict[x[0][:-2]].resttime() + " blockiert.")
else:
self.head.sendMsg(matchlist[1],x[0][:-2] + " hat nun einen karmawert von " + str(self.karmadict[x[0][:-2]].value))
if x[1]:
if not x[1][:-2] in self.karmadict:
e = KarmaEntry(x[1][:-2])
self.karmadict[x[1][:-2]] = e
if not self.karmadict[x[1][:-2]].add(-1):
self.head.sendMsg(matchlist[1],"Karmaspam - " + x[1][:-2] + " ist noch " + self.karmadict[x[1][:-2]].resttime() + " blockiert.")
else:
self.head.sendMsg(matchlist[1],x[1][:-2] + " hat nun einen karmawert von " + str(self.karmadict[x[1][:-2]].value))
if x[2]:
if not x[2][:-2] in self.karmadict:
e = KarmaEntry(x[2][:-2])
self.karmadict[x[2][:-2]] = e
self.head.sendMsg(matchlist[1],x[2][:-2] + " hat einen karmawert von " + str(self.karmadict[x[2][:-2]].value))
if (karmalist != []):
obj2file(self.karmadict,self.filename)
class KarmaEntry(object):
karmaspam = datetime.timedelta(0,600)
def __init__(self,name):
self.name = name
self.time = datetime.datetime(1,1,1)
self.value = 0
def add(self,value):
if (datetime.datetime.now() - self.time) > self.karmaspam:
self.value += value
self.time = datetime.datetime.now()
return True
else:
return False
def resttime(self):
return timedelta2string(self.karmaspam - (datetime.datetime.now() - self.time))[:-4]
class StfuMod(IRCBotMod):
regexpattern = r':(.+) PRIVMSG ({0}) :.*(?:(?i)stfu)(\d*).*'
moderated = False
defaulttime = 1800
def __init__(self,head):
IRCBotMod.__init__(self,head)
self.regexpattern = self.regexpattern.format(self.head.mainchannel)
self.handleInput = self.stfutrigger
self.timer = None
def __del__(self):
if self.timer:
self.timer.cancel()
self.timer = None
def stfutrigger(self,matchlist,time=defaulttime):
host = matchlist[0]
target = matchlist[1]
if (matchlist[2]):
time = int(matchlist[2])
else:
time = self.defaulttime
if (not self.moderated):
self.head.sendMsg(target,"*mute*")
self.head.sendraw("mode {0} +m".format(self.head.mainchannel))
self.moderated = True
self.timer = Timer(time,self.unmute)
self.timer.start()
else:
self.head.sendMsg(target,"*unmute*")
self.unmute()
if self.timer:
self.timer.cancel()
self.timer = None
def unmute(self):
self.moderated = False
self.head.sendraw(("mode {0} -m").format(self.head.mainchannel))
class TikkleMod(IRCBotMod):
regexpattern = r':(.+) PRIVMSG ([\S]+) :(.+)'
filename = "tikkle.dict"
def __init__(self,head):
IRCBotMod.__init__(self,head)
self.handleInput = self.handler
try:
self.tikklers = file2obj(self.filename)
except Exception:
self.tikklers = {}
def handler(self,matchlist):
host = matchlist[0]
target = matchlist[1] if matchlist[1] != self.head.nickname else nick(host)
text = matchlist[2]
t = matchlist[2].split(" ")
if (t[0] == "tikkle"):
if (len(t) > 2):
if (t[1] == "hi"):
try:
r = re.match(list2string(t[2:]),"")
except Exception as inst:
self.head.sendErr(target,inst)
else:
if nick(host) in self.tikklers:
x = self.tikklers[nick(host)]
x.regex = list2string(t[2:])
self.head.sendNotice(nick(host),"Ok "+ x.name + ", regex updated.")
else:
self.tikklers[nick(host)] = tikkleuser(nick(host),list2string(t[2:]))
self.head.sendNotice(nick(host),"Welcome to tikkle.")
if (t[1] == "friend"):
try:
if (self.tikklers[t[2]] not in self.tikklers[nick(host)].friendlist):
self.tikklers[nick(host)].friendlist.append(self.tikklers[t[2]])
self.head.sendNotice(nick(host),"Friend added.")
else:
self.tikklers[nick(host)].friendlist.remove(self.tikklers[t[2]])
self.head.sendNotice(nick(host),"Friend deleted.")
except KeyError:
self.head.sendNotice(nick(host),"Couldn't befriend you. Either you or " + t[2] + " isn't registered.")
if (t[1] == "tikkle"):
try:
self.tikklers[t[2]].mailbox.append([datetime.datetime.now(),"<" + nick(host) + "> " + list2string(t[3:]) if len(t) > 2 else "*tikkle*"])
self.head.sendMsg(nick(host),"Message sent.")
except Exception:
self.head.sendNotice(nick(host),"Couldnt send message. Either you or the target isnt registered.")
if nick(host) in self.tikklers:
x = self.tikklers[nick(host)]
if re.match(x.regex,text) and (x.name in nick(host)):
target = nick(host)
self.head.sendNotice(nick(host),"Hi.")
x.greet(text)
for y in x.friendlist:
self.head.sendNotice(nick(host),y.greettime.strftime("%A@%H:%M") + " <" + y.name + "> " + y.greeting)
for y in x.mailbox:
self.head.sendNotice(target,y[0].strftime("%d %b@%H:%M") + " " + y[1])
x.mailbox = []
obj2file(self.tikklers,self.filename)
class tikkleuser(object):
def __init__(self,name,regex):
self.name = name
self.regex = regex
self.greettime = datetime.datetime.now()
self.friendlist = []
self.mailbox = []
self.greeting = "tikkle hi " + str(regex)
def greet(self,t):
self.greettime = datetime.datetime.now()
self.greeting = t
class TimerMod(IRCBotMod):
regexpattern = r':(.+) PRIVMSG ([\S]+) :.*timer:(\d+):(.*)'
def __init__(self,head):
IRCBotMod.__init__(self,head)
self.handleInput = self.handler
def handler(self,matchlist):
host = matchlist[0]
target = matchlist[1] if matchlist[0] != self.head.nickname else nick(host)
time = matchlist[2]
text = matchlist[3]
if (int(time) > 0):
self.head.sendNotice(nick(host),"Timer started.")
Timer(int(time),self.head.sendMsg,(target,"timed message by " + nick(host) + ": " + text)).start()
class ToolsMod(IRCBotMod):
regexpattern = r'(.+)'
triggerlist = []
def __init__(self,head):
IRCBotMod.__init__(self,head)
self.handleInput = self.handler
def handler(self,text):
elementstodelete = []
for x in self.triggerlist:
if (re.match(x[2],text)):
if (type(x[1]) == type("str")):
self.head.sendMsg(x[0],x[1] + re.findall(x[2],text)[0])
else:
self.head.sendMsg(x[0],x[1](*re.findall(x[2],text)))
elementstodelete.append(x)
#two loops, to not disturb the first one <.<
for x in elementstodelete:
self.triggerlist.remove(x)
if (re.match(r':(.+) (PRIVMSG|\d+) ([\S]+)(?:$| (.+))',text)):
matchlist = re.findall(r':(.+) (PRIVMSG|\d+) ([\S]+)(?:$| (.+))',text)
matchlist = matchlist[0]
host = matchlist[0]
target = matchlist[2] if matchlist[2] != self.head.nickname else nick(host)
text = matchlist[3][1:]
w = text.split(" ")
if (len(w) > 1) and (matchlist[1] == "PRIVMSG"):
if (w[0] == "whois"):
self.head.sendraw("whois " + w[1] + " " + w[1])
self.addtrigger([target,self.identhost,r'.+ 311 (?:[\S]+) (?:[\S]+) ([\S]+) ([\S]+).+'])
self.addtrigger([target,"Real Name: ",r'.+ 311 (?:[\S]+) .+:(.+)'])
self.addtrigger([target,"Authnick: ",r'.+ 330 (?:[\S]+) (?:[\S]+) ([\S]+).+'])
self.addtrigger([target,self.raw317reply,r'.+ 317 (?:[\S]+) (?:[\S]+) (\d+ \d+)'])
elif (w[1] == "alive?"):
self.head.sendraw("whois " + w[0] + " " + w[0])
self.addtrigger([target,self.raw317reply,r'.+ 317 (?:[\S]+) (?:[\S]+) (\d+ \d+)'])
elif (w[1] == "lag?"):
self.head.sendMsg(w[0],chr(1) + "PING " + str(time.time()) + chr(1))
self.addtrigger([target,self.pingreply,r':({0}[\S]+) NOTICE (?:[\S]+) :.PING ([\d\.]+).'.format(w[0])])
elif (matchlist[1] == "PRIVMSG"):
if (w[0] == "lag?"):
self.head.sendMsg(nick(host),chr(1) + "PING " + str(time.time()) + chr(1))
self.addtrigger([target,self.pingreply,r':({0}[\S]+) NOTICE (?:[\S]+) :.PING ([\d\.]+).'.format(nick(host))])
def identhost(self,match):
return "Address: " + match[0] + "@" + match[1]
def pingreply(self,match):
n = nick(match[0])
t = time.time() - float(match[1])
return n + " ping reply: " + str(int(t * 1000)) + "ms"
def raw317reply(self,match):
idletime = int(str(match).split(" ")[0])
uptime = int(str(match).split(" ")[1])
return "Idle: " + str(datetime.timedelta(seconds=idletime)) + " // On Since: " + str(time.ctime(uptime))
def addtrigger(self,l):
if (l not in self.triggerlist):
self.triggerlist.append(l)
def nick(host):
return host.split("!")[0]
def timedelta2string(r):
r = str(r)
while ((r[0] == "0") or (r[0] == ":")):
r = r[1:]
return r[0:-3]
def obj2file(obj,filename):
f = open(filename,"w")
cPickle.dump(obj,f)
f.close()
def file2obj(filename):
f = open(filename,"r")
return cPickle.load(f)
f.close()
def asciicount(text):
r = 0
for x in text:
r += ord(x)
return r
def ident(text):
return list2string(text.split("!")[1].split("@")[0],"")
def list2string(l,s = " "):
r = ""
for x in l:
r = r + s+ x
return r[len(s):]
def rand(min = 1,max = 100):
return int(round(min + random() * (max - min)))
def main(instance=None):
global bot
try:
(SERVER,PORT,IDENT,PASS,NICKNAME,MAINCHANNEL,ADMINAUTHPASS) = file2obj("pyhkal.conf")
except IOError:
PORT = 6667
SERVER = "irc.quakenet.org"
NICKNAME = "FAiLHKAL" + str(rand(1,9999999))
IDENT = "FAiLHKAL"
PASS = ""
MAINCHANNEL = "#ich-sucke"
ADMINAUTHPASS = "default"
obj2file((SERVER,PORT,IDENT,PASS,NICKNAME,MAINCHANNEL,ADMINAUTHPASS),"pyhkal.conf")
if instance:
IRCBot.__init__(instance, SERVER,PORT,IDENT,PASS,NICKNAME,MAINCHANNEL, False)
bot = instance
else:
bot = IRCBot(SERVER,PORT,IDENT,PASS,NICKNAME,MAINCHANNEL)
def exportconf():
obj2file((SERVER,PORT,IDENT,PASS,NICKNAME,MAINCHANNEL,ADMINAUTHPASS),"pyhkal.conf")
def exportperform():
obj2file(bot.performqueue,bot.performfilename)
bot.addModule(AdminMod,[ADMINAUTHPASS])
bot.addModule(DecideMod)
bot.addModule(CubeMod)
bot.addModule(KarmaMod)
bot.addModule(TikkleMod)
bot.addModule(TimerMod)
bot.addModule(ToolsMod)
bot.addModule(StfuMod)
asyncore.loop()
print "reloading - asyncore dumped"
main()
if __name__ == '__main__':
main()