def BAMBAM(self, e, match): brain.set(e.source.nick, time.time()) t = e.arguments[0] runi = re.search(runicode, t) if (runi is not None): try: self.r(e, "%s" % eval(runi.group()) ) except: pass if self.BAM == t: self.r(e, self.BAM) self.BAM = None else: try: if self.BAM.lower() == self.BAM and \ self.BAM.upper() == t: marks = re.compile("([!?.;:]+)$") m = marks.search(t) if m: m = m.groups()[0] t = marks.sub('', t) else: m = '' t = re.sub('i?[aeiou]$', '', t, flags=re.IGNORECASE) self.r(e, "%sISSIMO%s" % (t, m)) self.BAM = None else: self.BAM = t except: self.BAM = t return True
def karmelino(self, e, match): icche = match.groups()[0].lower() if icche in self.arnaldo.channels[CHAN].users(): indove = u'__karma_%s'.encode('utf-8') % (icche, ) k = (lambda x: int(x) if x is not None else 0)(brain.get(indove)) - 1 brain.set(indove, k)
def karmelone(self, e, match): icche = match.groups()[0].lower() print self.arnaldo.channels[CHAN].users() if icche in self.arnaldo.channels[CHAN].users(): indove = u'__karma_%s'.encode('utf-8') % (icche,) k = (lambda x: int(x) if x is not None else 0)(brain.get(indove)) + 1 brain.set(indove, k) self.r(e, u'%s: %d'.encode('utf-8') % (icche, k))
def karmelone(self, e, match): icche = match.groups()[0].lower() indove = u'__karma_%s'.encode('utf-8') % (icche,) k = brain.get(indove) brain.set(indove, 1 + (int(k) if k else 0)) # self.r(e, 'vabbé'.decode('utf-8')) # non cagare il cazzo k = brain.get(indove) self.r(e, u'%s: %d'.encode('utf-8') % (icche, int(k)))
def add_quote(self, e, match): try: author = e.source.nick quote = match.groups()[0] maxa = max([int(x.split(":")[1]) for x in brain.keys("quote:*")]) q = {"author": author, "date": str(time.time()), "id": str(maxa + 1), "quote": quote} brain.set(u"quote:%d" % (maxa + 1), q) self.r(e, "vai agile [#%d]" % (maxa + 1)) except: self.r(e, "macche'")
def add_quote(self, e, match): author = e.source.nick quote = match.groups()[0] maxa = max([int(x.split(':')[1]) for x in brain.keys('quote:*')]) q = { "author": author, "date": str(time.time()), "id": str(maxa + 1), "quote": quote } brain.set("quote:%d" % (maxa + 1), q)
def add_quote(self, e, match): try: author = e.source.nick quote = match.groups()[0] maxa = max([int(x.split(':')[1]) for x in brain.keys('quote:*')]) q = { "author": author, "date": str(time.time()), "id": str(maxa + 1), "quote": quote } brain.set(u"quote:%d" % (maxa + 1), q) self.r(e, "vai agile [#%d]" % (maxa + 1)) except: self.r(e, "macche'")
def oembeddalo(self, e, match): allurls = URL_RE.findall(e.arguments[0]) if len(allurls) != 1: return True #tipo goto ma peggio try: respa = request_oembed(allurls[0][0]) except: pass thaurlhash = hashlib.md5(allurls[0][0]).hexdigest() hashish = brain.get("urlo:%s" % thaurlhash) try: if hashish is None: # NO FUMO NO FUTURE ts = time.time() nic = e.source.nick brain.set("urlo:%s" % thaurlhash, "%f:%s:%d" % (ts, nic, 1)) self.r(e, respa['title']) else: secondianno = 31556926 # num secondi in un anno youdontsay.png ts, nic, v = hashish.split(':') ts = float(ts) delta = time.time() - ts v = int(v) + 1 brain.set("urlo:%s" % thaurlhash, "%f:%s:%d" % (ts, nic, v)) manti, expo = map( float, ("%e" % (delta / secondianno)).split("e")) symb, todo = check_SI(expo * v) dignene = "%.2f %sGaggo [postato da %s il %s]" % \ (manti + v, symb, nic, datetime.datetime.fromtimestamp( ts).strftime('%d/%m/%y %H:%M:%S')) self.r(e, dignene) except: pass return True
def oembeddalo(self, e, match): allurls = URL_RE.findall(e.arguments[0]) if len(allurls) != 1: return True #tipo goto ma peggio try: respa = request_oembed(allurls[0][0]) except: pass thaurlhash = hashlib.md5(allurls[0][0]).hexdigest() hashish = brain.get("urlo:%s" % thaurlhash) try: if hashish is None: # NO FUMO NO FUTURE ts = time.time() nic = e.source.nick brain.set("urlo:%s" % thaurlhash, "%f:%s:%d" % (ts, nic, 1)) self.r(e, respa['title']) elif "[pnd]" not in e.arguments[0].lower(): secondianno = 31556926 # num secondi in un anno youdontsay.png ts, nic, v = hashish.split(':') ts = float(ts) delta = time.time() - ts v = int(v) + 1 brain.set("urlo:%s" % thaurlhash, "%f:%s:%d" % (ts, nic, v)) manti, expo = map( float, ("%e" % (delta / secondianno)).split("e")) symb, todo = check_SI(expo * v) dignene = "%.2f %sGaggo [postato da %s il %s]" % \ (manti + v, symb, nic, datetime.datetime.fromtimestamp( ts).strftime('%d/%m/%y %H:%M:%S')) self.r(e, dignene) except: pass return True
def karmelino(self, e, match): icche = match.groups()[0].lower() indove = u'__karma_%s'.encode('utf-8') % (icche,) k = brain.get(indove) brain.set(indove, (int(k) if k else 0) - 1)