def f_remind(willie, trigger): teller = trigger.nick verb, tellee, msg = trigger.groups() verb = unicode(verb) tellee = Nick(tellee.rstrip('.,:;')) msg = unicode(msg) if not os.path.exists(willie.tell_filename): return if len(tellee) > 20: return willie.reply('That nickname is too long.') if tellee == willie.nick: return willie.reply("I'm here now, you can tell me whatever you want!") tz, tformat = get_user_time(willie, tellee) print tellee, tz, tformat timenow = datetime.datetime.now(tz).strftime(tformat) if not tellee in (Nick(teller), willie.nick, 'me'): willie.memory['tell_lock'].acquire() try: if not willie.memory['reminders'].has_key(tellee): willie.memory['reminders'][tellee] = [(teller, verb, timenow, msg)] else: willie.memory['reminders'][tellee].append((teller, verb, timenow, msg)) finally: willie.memory['tell_lock'].release() responses = [ "%s doesn't care, but I'll force it in conversation.", "%s is probably just ignoring you.", "Sure, I'll tell %s that right after you go outside once for in your life.", "Sure says something when %s gives me more attention than they give you, doesn't it?", "Sure, fine, whatever. I'll leave %s your message.", "Alright, but I apologize in advance if %s just doesn't care.", "Alright, next time I see %s I'll tell them that, just so you don't have to worry about spilling spaghetti on yourself.", "I'll leave that with %s. Later. If I feel like it.", "Aaalright, if you insist, but %s probably thinks you're just drunk right now.", ] response = random.choice(responses) % tellee willie.reply(response) elif Nick(teller) == tellee: willie.say("Look at me, I'm %s and I'm super clever at breaking IRC bots! I'm oozing cleverness!" % teller) else: willie.say("Hey, I'm not as stupid as Monty you know!") dumpReminders(willie.tell_filename, willie.memory['reminders'], willie.memory['tell_lock']) # @@ tell
def f_remind(bot, trigger): """Give someone a message the next time they're seen""" teller = trigger.nick verb = trigger.group(1) tellee, msg = trigger.group(2).split(None, 1) tellee = Nick(tellee.rstrip('.,:;')) if not os.path.exists(bot.tell_filename): return if len(tellee) > 20: return bot.reply('That nickname is too long.') if tellee == bot.nick: return bot.reply("I'm here now, you can tell me whatever you want!") tz, tformat = get_user_time(bot, tellee) print tellee, tz, tformat timenow = datetime.datetime.now(tz).strftime(tformat) if not tellee in (Nick(teller), bot.nick, 'me'): bot.memory['tell_lock'].acquire() try: if not tellee in bot.memory['reminders']: bot.memory['reminders'][tellee] = [(teller, verb, timenow, msg) ] else: bot.memory['reminders'][tellee].append( (teller, verb, timenow, msg)) finally: bot.memory['tell_lock'].release() response = "I'll pass that on when %s is around." % tellee bot.reply(response) elif Nick(teller) == tellee: bot.say('You can %s yourself that.' % verb) else: bot.say("Hey, I'm not as stupid as Monty you know!") dumpReminders(bot.tell_filename, bot.memory['reminders'], bot.memory['tell_lock']) # @@ tell
def f_remind(willie, trigger): teller = trigger.nick verb, tellee, msg = trigger.groups() verb = unicode(verb) tellee = Nick(tellee.rstrip('.,:;')) msg = unicode(msg) if not os.path.exists(willie.tell_filename): return if len(tellee) > 20: return willie.reply('That nickname is too long.') if tellee == willie.nick: return willie.reply("I'm here now, you can tell me whatever you want!") tz, tformat = get_user_time(willie, tellee) print tellee, tz, tformat timenow = datetime.datetime.now(tz).strftime(tformat) if not tellee in (Nick(teller), willie.nick, 'me'): willie.memory['tell_lock'].acquire() try: if not willie.memory['reminders'].has_key(tellee): willie.memory['reminders'][tellee] = [(teller, verb, timenow, msg)] else: willie.memory['reminders'][tellee].append( (teller, verb, timenow, msg)) finally: willie.memory['tell_lock'].release() response = "I'll pass that on when %s is around." % tellee willie.reply(response) elif Nick(teller) == tellee: willie.say('You can %s yourself that.' % verb) else: willie.say("Hey, I'm not as stupid as Monty you know!") dumpReminders(willie.tell_filename, willie.memory['reminders'], willie.memory['tell_lock']) # @@ tell
def f_remind(bot, trigger): """Give someone a message the next time they're seen""" teller = trigger.nick verb = trigger.group(1) tellee, msg = trigger.group(2).split(None, 1) tellee = Nick(tellee.rstrip(".,:;")) if not os.path.exists(bot.tell_filename): return if len(tellee) > 20: return bot.reply("That nickname is too long.") if tellee == bot.nick: return bot.reply("I'm here now, you can tell me whatever you want!") tz, tformat = get_user_time(bot, tellee) print tellee, tz, tformat timenow = datetime.datetime.now(tz).strftime(tformat) if not tellee in (Nick(teller), bot.nick, "me"): bot.memory["tell_lock"].acquire() try: if not tellee in bot.memory["reminders"]: bot.memory["reminders"][tellee] = [(teller, verb, timenow, msg)] else: bot.memory["reminders"][tellee].append((teller, verb, timenow, msg)) finally: bot.memory["tell_lock"].release() response = "I'll pass that on when %s is around." % tellee bot.reply(response) elif Nick(teller) == tellee: bot.say("You can %s yourself that." % verb) else: bot.say("Hey, I'm not as stupid as Monty you know!") dumpReminders(bot.tell_filename, bot.memory["reminders"], bot.memory["tell_lock"]) # @@ tell
def f_remind(willie, trigger): teller = trigger.nick verb, tellee, msg = trigger.groups() verb = unicode(verb) tellee = Nick(tellee.rstrip(".,:;")) msg = unicode(msg) if not os.path.exists(willie.tell_filename): return if len(tellee) > 20: return willie.reply("That nickname is too long.") if tellee == willie.nick: return willie.reply("I'm here now, you can tell me whatever you want!") tz, tformat = get_user_time(willie, tellee) print tellee, tz, tformat timenow = datetime.datetime.now(tz).strftime(tformat) if not tellee in (Nick(teller), willie.nick, "me"): willie.memory["tell_lock"].acquire() try: if not willie.memory["reminders"].has_key(tellee): willie.memory["reminders"][tellee] = [(teller, verb, timenow, msg)] else: willie.memory["reminders"][tellee].append((teller, verb, timenow, msg)) finally: willie.memory["tell_lock"].release() response = "I'll pass that on when %s is around." % tellee willie.reply(response) elif Nick(teller) == tellee: willie.say("You can %s yourself that." % verb) else: willie.say("Hey, I'm not as stupid as Monty you know!") dumpReminders(willie.tell_filename, willie.memory["reminders"], willie.memory["tell_lock"]) # @@ tell