def handle(self, msg, nick): users = [ "Socke", "Malte", "Fatfox", "Schneck", "thomasba", "T", "tchab", "Koch", "Hacki", "willi", "allen", nick ] cookies = [ "Bier", "Brownie", "Steak", "Club-Sandwich", "Energy-Drink", "Regenbogen", "Burger", "Wein", "Vanille", "Lima", "Wolken", "Schoko", "Erdbeer", "Veggie", "Cola", "Limo", "Karamel", "Ananas", "Schinken", "Kaffee", "Koffein", "Hack", "Krümel", "Lachflash", "Kinder", "Apfel", "Bananen", "Sarkasmus", "Ironie", "Klugscheißer", "Virtuellen" ] now = datetime.datetime.now() if now.month == 12: cookies += ["Weihnachts", "Zimt"] elif now.month == 10: cookies += ["Kürbis"] elif now.month == 4: cookies += ["Osterhasen", "Lamm"] if now.hour >= 16 or now.weekday() >= 4: cookies += ["Bier", "Bier", "Bier"] r = r'(?i)^(\w[\w-]*-?)?(keks f(ü|ue)r|cookie for) ([\w@äöü\s_°/-]*[\w@äöü_°/-])(!|\?)?$' match = re.match(r, msg) if match: users = [match.group(4)] if match.group(4) == "tchab": cookies = ["Regenbogen", "Wurst"] elif match.group(4) in ["sonok", "snook", "Socke"]: cookies = ["Nudel", "Ketchup", "Nudel-Ketchup"] elif match.group(4) in ["c143", "tse143", "tse", "c143po"]: cookies = [ "Bier", "Pizza", "Kartoffel", "Tofu", "Salat", "Imaginären" ] elif match.group(4) in ["arcardy@webchat", "arcardy"]: cookies = [ "Closed-Recipe", "MSSQL", "Windows", "Plastik", "Python" ] elif match.group(4) == "mich": users = [nick] if not match.group(1) is None: if match.group(1)[-1] == '-': cookie = match.group(1)[:-1].split('-') else: cookie = match.group(1).split('-') cookie = [x[0].upper() + x[1:].lower() \ for x in cookie] cookies = ["-".join(cookie)] if match.group(5) == '?': return 'nein!' elif not msg.lower() in ['keks', 'keks!', 'cookie', 'cookie!']: return False return "/me gibt %s einen %s-Keks." % (oneof(users), oneof(cookies))
def handle(self, msg, nick): users = ["Socke", "Malte", "Fatfox", "Schneck", "thomasba", "T", "tchab", "Koch", "Hacki", "willi", "allen", nick] cookies = ["Bier", "Brownie", "Steak", "Club-Sandwich", "Energy-Drink", "Regenbogen", "Burger", "Wein", "Vanille", "Lima", "Wolken", "Schoko", "Erdbeer", "Veggie", "Cola", "Limo", "Karamel", "Ananas", "Schinken", "Kaffee", "Koffein", "Hack", "Krümel", "Lachflash", "Kinder", "Apfel", "Bananen", "Sarkasmus", "Ironie", "Klugscheißer", "Virtuellen"] now = datetime.datetime.now() if now.month == 12: cookies += ["Weihnachts", "Zimt"] elif now.month == 10: cookies += ["Kürbis"] elif now.month == 4: cookies += ["Osterhasen", "Lamm"] if now.hour >= 16 or now.weekday() >= 4: cookies += ["Bier", "Bier", "Bier"] r = r'(?i)^(\w[\w-]*-?)?(keks f(ü|ue)r|cookie for) ([\w@äöü\s_°/-]*[\w@äöü_°/-])(!|\?)?$' match = re.match(r, msg) if match: users = [match.group(4)] if match.group(4) == "tchab": cookies = ["Regenbogen", "Wurst"] elif match.group(4) in ["sonok", "snook", "Socke"]: cookies = ["Nudel", "Ketchup", "Nudel-Ketchup"] elif match.group(4) in ["c143", "tse143", "tse", "c143po"]: cookies = ["Bier", "Pizza", "Kartoffel", "Tofu", "Salat", "Imaginären"] elif match.group(4) in ["arcardy@webchat", "arcardy"]: cookies = ["Closed-Recipe", "MSSQL", "Windows", "Plastik", "Python"] elif match.group(4) == "mich": users = [ nick ] if not match.group(1) is None: if match.group(1)[-1] == '-': cookie = match.group(1)[:-1].split('-') else: cookie = match.group(1).split('-') cookie = [x[0].upper() + x[1:].lower() \ for x in cookie] cookies = [ "-".join(cookie) ] if match.group(5) == '?': return 'nein!' elif not msg.lower() in ['keks', 'keks!', 'cookie', 'cookie!']: return False return "/me gibt %s einen %s-Keks." % (oneof(users), oneof(cookies))
def handle(self, msg, nick): users = [ "Socke", "Malte", "Fatfox", "Schneck", "thomasba", "T", "tchab", "Koch", "Hacki", "willi", "allen", nick ] cookies = [ "Bier", "Brownie", "Steak", "Club-Sandwich", "Energy-Drink", "Regenbogen", "Burger", "Wein", "Vanille", "Lima", "Wolken", "Schoko", "Erdbeer", "Veggie", "Cola", "Limo", "Karamel", "Ananas", "Schinken", "Kaffee", "Koffein" ] now = datetime.datetime.now() if now.month == 12: cookies += ["Weihnachts", "Zimt"] elif now.month == 10: cookies += ["Kürbis"] elif now.month == 4: cookies += ["Osterhasen", "Lamm"] if now.hour >= 16 or now.weekday() >= 4: cookies += ["Bier", "Bier", "Bier"] r = r'(?i)^(\w[\w-]*-)?keks für (\w+)(!|\?)?$' match = re.match(r, msg) if match: users = [match.group(2)] if match.group(2) == "tchab": cookies = ["Regenbogen", "Wurst"] elif match.group(2) in ["sonok", "snook", "Socke"]: cookies = ["Nudel", "Ketchup", "Nudel-Ketchup"] elif match.group(2) in ["c143", "tse143", "tse", "c143po"]: cookies = [ "Bier", "Pizza", "Kartoffel", "Tofu", "Salat", "Imaginären" ] if not match.group(1) is None: cookie = match.group(1)[:-1].split('-') cookie = [x[0].upper() + x[1:].lower() \ for x in cookie] cookies = ["-".join(cookie)] if match.group(3) == '?': return 'nein!' elif not msg.lower() in ['keks', 'keks?', 'keks!']: return False return "/me gibt %s einen %s-Keks." % (oneof(users), oneof(cookies))
def handle(self, msg, nick): users = ["Socke", "Malte", "Fatfox", "Schneck", "thomasba", "T", "tchab", "Koch", "Hacki", "willi", "allen", nick] cookies = ["Bier", "Brownie", "Steak", "Club-Sandwich", "Energy-Drink", "Regenbogen", "Burger", "Wein", "Vanille", "Lima", "Wolken", "Schoko", "Erdbeer", "Veggie", "Cola", "Limo", "Karamel", "Ananas", "Schinken", "Kaffee", "Koffein"] now = datetime.datetime.now() if now.month == 12: cookies += ["Weihnachts", "Zimt"] elif now.month == 10: cookies += ["Kürbis"] elif now.month == 4: cookies += ["Osterhasen", "Lamm"] if now.hour >= 16 or now.weekday() >= 4: cookies += ["Bier", "Bier", "Bier"] r = r'(?i)^(\w[\w-]*-)?keks für (\w+)(!|\?)?$' match = re.match(r, msg) if match: users = [match.group(2)] if match.group(2) == "tchab": cookies = ["Regenbogen", "Wurst"] elif match.group(2) in ["sonok", "snook", "Socke"]: cookies = ["Nudel", "Ketchup", "Nudel-Ketchup"] elif match.group(2) in ["c143", "tse143", "tse", "c143po"]: cookies = ["Bier", "Pizza", "Kartoffel", "Tofu", "Salat", "Imaginären"] if not match.group(1) is None: cookie = match.group(1)[:-1].split('-') cookie = [x[0].upper() + x[1:].lower() \ for x in cookie] cookies = [ "-".join(cookie) ] if match.group(3) == '?': return 'nein!' elif not msg.lower() in ['keks', 'keks?', 'keks!']: return False return "/me gibt %s einen %s-Keks." % (oneof(users), oneof(cookies))
def muc_msg(self, msg, nick, **keywords): key = msg.lower() if key in self.mapping: if nick in self.users: self.send_muc(oneof(self.users[nick])) else: self.send_muc(self.mapping[key])
def pingpong(self, msg, nick, formatstr): key = msg.lower(); if nick in self.users and key in self.users[nick]: self.send_muc(formatstr % \ oneof(self.users[nick][key])) elif key in self.mapping: self.send_muc(formatstr % \ self.mapping[key])
def pingpong(self, msg, nick, formatstr): key = msg.lower() if nick in self.users and key in self.users[nick]: self.send_muc(formatstr % \ oneof(self.users[nick][key])) elif key in self.mapping: self.send_muc(formatstr % \ self.mapping[key])
def muc_mention(self, msg, nick, **keywords): key = msg.lower() if key in self.mapping: if nick in self.users: self.send_muc("%s: %s" % \ (nick, oneof(self.users[nick]))) else: self.send_muc("%s: %s" % \ (nick, self.mapping[key]))
def __call__(self, msg, nick, send_message): if not self.config.intrusive: return False if msg.lower().startswith("entweder"): return False choices = self.choice(msg.strip()) if choices: send_message(oneof(choices)) return True return False
def ist_das_falsch(self): return oneof(["ja", "nein"])
def do_troll(self, nick): msg = oneof(self.trollmsg) if nick == "bw5rws": msg = oneof([msg, "Da hattest du wohl wieder keine Ahnung ..."]) self.send_private(nick, msg, muc=True)
def stimmt_das(self): return oneof(["ja", "nein"])
def ist_das_schlimm(self): return oneof(["ja", "nein", "vielleicht"])
def __call__(self, msg, nick, send_message): if msg in self.g: send_message(oneof(self.greetings)) return True return False
def do_troll(self, nick): msg = oneof(self.trollmsg) self.send_private(nick, msg, muc=True)