def justxthingshandler(jenni, msg): from modules.brittbot.pil import justxthings from modules.find import load_db hashtag = msg.groups()[1] quote = msg.groups()[0] if not quote: quotes = load_db().get(msg.sender) if quotes and 'last_said' in quotes: quotes['last_said'] = [quote for quote in quotes['last_said'] if not re.match(r'(.*)(#\S+\w)$', quote)] quote = ''.join(quotes['last_said'][-1].split(':')[1:]) if quote[0] in ['!'] or 'http' in quote: return if hashtag.startswith("##"): return if len(quote.split(' ')) > 25: return url = "http://brittbot.brittg.com/{}".format(justxthings.generate_image( str(quote), hashtag, )) jenni.reply(url)
def justxthingslistener(jenni, msg): from modules.brittbot.pil import justxthings if msg.sender not in [ "#internship", "#r/kansascity", "#reddit-stlouis", "demophoon", ]: return if 'last_action' not in jenni.brain: jenni.brain['last_action'] = {} if msg.sender not in jenni.brain['last_action']: jenni.brain['last_action'][msg.sender] = 0 if time.time() < jenni.brain['last_action'][msg.sender] + 3600: return if len(msg.split(' ')) == 1 or len(msg.split(' ')) > 20: return try: if str(msg)[0] in ['!']: return except Exception: return if random.choice(range(175)) == 0: url = "http://brittbot.brittg.com/{}".format(justxthings.generate_image( str(msg), "#just{}things".format(msg.nick) )) jenni.say(url) jenni.brain['last_action'][msg.sender] = time.time()
def justxthingslistener(jenni, msg): from modules.brittbot.pil import justxthings if 'last_action' not in jenni.brain: jenni.brain['last_action'] = {} if msg.sender not in jenni.brain['last_action']: jenni.brain['last_action'][msg.sender] = 0 if time.time() < jenni.brain['last_action'][msg.sender] + 3600: return if len(msg.split(' ')) == 1 or len(msg.split(' ')) > 20: return try: if str(msg)[0] in ['!']: return except Exception: return if "action" in msg.lower(): return if random.choice(range(175)) == 0: url = "http://brittbot.brittg.com/{}".format(justxthings.generate_image( str(msg), "#just{}things".format(msg.nick) )) jenni.say(url) jenni.brain['last_action'][msg.sender] = time.time()
def justxthingshandler(jenni, msg): from modules.brittbot.pil import justxthings from modules.find import load_db hashtag = msg.groups()[1] quote = msg.groups()[0] if not quote: quotes = load_db().get(msg.sender) if quotes and 'last_said' in quotes: quotes['last_said'] = [quote for quote in quotes['last_said'] if not re.match(r'(.*)(#\S+\w)$', quote)] quote = ''.join(quotes['last_said'][-1].split(':')[1:]) if quote[0] in ['!'] or 'http' in quote: return if hashtag.startswith("##"): return if "action" in msg.lower(): return if len(quote.split(' ')) > 25: return url = "http://brittbot.brittg.com/{}".format(justxthings.generate_image( str(quote), hashtag, )) jenni.reply(url)
def justxthingshandler(jenni, msg): from modules.brittbot.pil import justxthings hashtag = msg.groups()[1] quote = msg.groups()[0] if quote[0] in ['!']: return if hashtag.startswith("##"): return url = "http://brittbot.brittg.com/%s" % justxthings.generate_image( str(quote), hashtag, ) jenni.reply(url)
def justxthingshandler(jenni, msg): from modules.brittbot.pil import justxthings from modules.find import load_db hashtag = msg.groups()[1] quote = msg.groups()[0] if not quote: quotes = load_db().get(msg.sender) if quotes and "last_said" in quotes: quotes["last_said"] = [quote for quote in quotes["last_said"] if not re.match(r"(.*)(#\S+\w)$", quote)] quote = "".join(quotes["last_said"][-1].split(":")[1:]) if quote[0] in ["!"] or "http" in quote: return if hashtag.startswith("##"): return if len(quote.split(" ")) > 25: return url = "http://brittbot.brittg.com/{}".format(justxthings.generate_image(str(quote), hashtag)) jenni.reply(url)
def justxthingslistener(jenni, msg): if 'last_action' not in jenni.brain: jenni.brain['last_action'] = {} if msg.sender not in jenni.brain['last_action']: jenni.brain['last_action'][msg.sender] = 0 if time.time() < jenni.brain['last_action'][msg.sender] + 3600: return if len(msg.split(' ')) == 1 or len(msg.split(' ')) > 20: return try: if str(msg)[0] in ['!']: return except Exception: return if "action" in msg.lower(): return if random.choice(range(175)) == 0: url = "http://brittbot.brittg.com/{}".format(justxthings.generate_image( str(msg), "#just{}things".format(msg.nick) )) jenni.say(url) jenni.brain['last_action'][msg.sender] = time.time()