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)
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)
def exportconf(self): obj2file((self.tikklers),self.configfilename)
def exportconf(self): obj2file((self.quotedict),self.configfilename)
def exportconf(self): obj2file((self.factoids),self.configfilename)
def exportconf(self): obj2file((self.karmadict),self.configfilename)
def exportconf(self): obj2file((self.adminpass),self.configfilename)