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 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 random_quote(self, e, match): q = brain.get(choice(brain.keys("quote:*"))) if q is None: return q = eval(q) self.r(e, u'#%s: %s' % (q['id'], q['quote']))
def pritaicsa(text): icsa = "" for row in range(int(brain.get("asciitable:rows"))): for c in text: icsa = str(icsa) + str(brain.lindex("asciitable:%s" % c, row)) icsa += '\n' icsa += '\n' return icsa
def karma(self, e, match): icche = match.groups()[0].lower() indove = u'__karma_%s'.encode('utf-8') % (icche, ) k = brain.get(indove) if k: self.r(e, u'karma %s: %d'.encode('utf-8') % (icche, int(k))) else: self.r(e, u'%s chi?'.encode('utf-8') % (icche, ))
def karma(self, e, match): icche = match.groups()[0].lower() indove = u'__karma_%s'.encode('utf-8') % (icche,) k = brain.get(indove) if k: self.r(e, u'karma %s: %d'.encode('utf-8') % (icche, int(k))) else: self.r(e, u'%s chi?'.encode('utf-8') % (icche, ))
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 random_quote(self, e, match): q = brain.get(choice(brain.keys("quote:*"))) if q is None: return q = eval(q) self.r(e, u"#%s: %s" % (q["id"], q["quote"]))
def get_quote(self, e, match): if match is None: return q = brain.get("quote:%s" % match.groups()[0]) if q is None: return q = eval(q) self.r(e, '#%s: %s' % (q['id'], q['quote']))
def get_quote(self, e, match): if match is None: return q = brain.get("quote:%s" % match.groups()[0]) if q is None: return q = eval(q) self.r(e, "#%s: %s" % (q["id"], q["quote"]))
def chilhavisto(self, e, match): try: ggallin = match.groups()[0] except: ggallin = None if not ggallin: return try: ts = brain.get(ggallin) if ts: response = "chiaro il %s" % datetime.datetime.fromtimestamp( float(ts)).strftime('%d/%m/%y %H:%M:%S') else: response = "macche'" self.r(e, response) except: pass
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)