From 75f5985d713dcdb3da58ad2cf57824c7b29f67f4 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Wed, 22 Feb 2017 23:10:01 -0600 Subject: [PATCH] countdown: simpler reminders when in privmsg --- countdown/ircplugin.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/countdown/ircplugin.py b/countdown/ircplugin.py index e34cd34..5229fd3 100644 --- a/countdown/ircplugin.py +++ b/countdown/ircplugin.py @@ -85,7 +85,9 @@ class Countdown(Plugin): sender_nick = irc.client.NickMask(event.source).nick sent_location = reply_destination_for_event(event) - if re.search(addressed_my_nick, what, re.IGNORECASE) is not None: + in_privmsg = sender_nick == sent_location + + if re.search(addressed_my_nick, what, re.IGNORECASE) is not None or in_privmsg: # we were addressed, were we told to add a reminder? trimmed_what = re.sub(addressed_my_nick, '', what) log.debug(trimmed_what) @@ -112,7 +114,7 @@ class Countdown(Plugin): when_t = timezone.make_aware(parse(when)) # parse the person to address, if anyone, when sending the notification - if who == 'us' or who == sent_location: + if who == 'us' or who == sent_location or in_privmsg: message = text elif who == 'me': message = '{0:s}: {1:s}'.format(sender_nick, text) @@ -123,7 +125,11 @@ class Countdown(Plugin): countdown_item = CountdownItem.objects.create(name=item_name, at_time=when_t, is_reminder=True, reminder_message=message, reminder_target=sent_location) log.info("created countdown item %s", str(countdown_item)) - self.bot.reply(event, "ok, i'll message {0:s} at {1:s}".format(sent_location, str(when_t))) + + if in_privmsg: + self.bot.reply(event, "ok, i'll message you at {0:s}".format(str(when_t))) + else: + self.bot.reply(event, "ok, i'll message {0:s} at {1:s}".format(sent_location, str(when_t))) return 'NO MORE'