def peep_incdec(self, target, source, args): input = args[-1] matches = re.match('^([a-zA-Z0-9_\\\[\]\{\}\^`\|]+)([\+|\-]{2}(?![\+|\-])).*', input) if not matches: return entity = matches.group(1) method = matches.group(2) if not entity: return source = Id(source) if not source.name or not source.is_authenticated: return if source.name == entity: self.chat("No self love.") simpleupdate(entity, -1000000) return mod = 1 if method == '--': mod = -1 if not simpleupdate(entity, False, random.randint(1, 100000) * mod, True): self.chat("mongodb seems borked", target=target) return self.chat('%s brought %s to %d' % (source.name, entity, entityScore(entity)), target=target)
def decrement(self): if not self.values: self.chat("you need to give someone your hate") return entity = " ".join(self.values) if entity == 'jcb': return if not simpleupdate(entity, False, random.randint(1, 100000) * -1, True): self.chat("mongodb seems borked") return return self.lastsender + " brought " + entity + " to " + str(entityScore(entity))
def workat(self): if not self.values: self.chat("If you're unemployed, that's cool, just don't abuse the bot") return name = self.lastsender company = " ".join(self.values) if not simpleupdate(name, "company", company): self.chat("Busto, bro.") return self.chat("Company updated.")
def checkwin(self): breaker = self.players[self.playerorder[self.turn]] if not breaker['broke']: return False self.gethigh() tally = 0 for player in self.players: if player == self.winner: continue spread = self.top - self.players[player]['score'] tally += spread simpleupdate(player, 'cash', spread * -1, True) if not tally: tally = self.top simpleupdate(player, 'cash', tally, True) return '%s wins it with %s.' % (self.winner, self.top)
def workat(self): if not self.values: self.chat( "If you're unemployed, that's cool, just don't abuse the bot") return name = self.lastsender company = " ".join(self.values) if not simpleupdate(name, "company", company): self.chat("Busto, bro.") return self.chat("Company updated.")
def addphone(self): if not self.values: self.chat("What number?") return phone = self.values[0] if not re.search("^[0-9]{10}$", phone): self.chat("Just one good ol'merican ten-digit number, thank ya kindly.") return name = self.lastsender if not simpleupdate(name, "phone", phone): self.chat("Some shit borked.") return self.chat("Number updated.")
def addphone(self): if not self.values: self.chat("What number?") return phone = self.values[0] if not re.search("^[0-9]{10}$", phone): self.chat( "Just one good ol'merican ten-digit number, thank ya kindly.") return name = self.lastsender if not simpleupdate(name, "phone", phone): self.chat("Some shit borked.") return self.chat("Number updated.")
def passwd(self): if not self.values: self.chat("Enter a password.") return if self.context == CHANNEL: self.chat("Not in the main channel, you twit.") return whom = self.lastsender h = hashlib.sha1() h.update(' '.join(self.values)) pwd = h.hexdigest() if not simpleupdate(whom, "password", pwd): self.chat("Fail.") return self.chat("Password set.")