From 12c71675d378ea4bf59a0409f87450a5d0d63470 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 17 Jul 2011 01:04:04 -0400 Subject: [PATCH] adding a !remind command from old EarwigBot, which spawns a new thread that sleeps until its time is up, so impimplementing in !tasks list; {} -> {0}, etc in tasks.py for Python 2.6 support; stripping indentation on blank lines in tasks.py --- irc/commands/remind.py | 50 +++++++++++++++++++++++++++++++++++++++++++ irc/commands/tasks.py | 58 ++++++++++++++++++++++++++------------------------ 2 files changed, 80 insertions(+), 28 deletions(-) create mode 100644 irc/commands/remind.py diff --git a/irc/commands/remind.py b/irc/commands/remind.py new file mode 100644 index 0000000..6de1767 --- /dev/null +++ b/irc/commands/remind.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +""" +Set a message to be repeated to you in a certain amount of time. +""" + +import threading +import time + +from irc.classes import BaseCommand + +class Remind(BaseCommand): + def get_hooks(self): + return ["msg"] + + def get_help(self, command): + return "Set a message to be repeated to you in a certain amount of time." + + def check(self, data): + if data.is_command and data.command in ["remind", "reminder"]: + return True + return False + + def process(self, data): + if not data.args: + self.connection.reply(data, "please specify a time (in seconds) and a message in the following format: !remind