Created
May 22, 2013 16:38
-
-
Save kingcons/5629005 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smokesignal | |
from helga.client import helga | |
from helga.extensions.base import CommandExtension, ContextualExtension | |
class MemoExtension(CommandExtension, ContextualExtension): | |
""" | |
Memos are very useful in IRC to leave a note for someone presently offline. | |
""" | |
NAME = 'memo' | |
usage = '[BOTNICK] memo for (RECIPIENT): (INPUT ...)' | |
memos = {} | |
def add_memo(self, user, memo): | |
deliver = lambda nick, chan: helga.msg(chan, memo) | |
smokesignal.once(('userJoined', 'privmsg'), deliver, | |
lambda nick, chan: nick == user) | |
def handle_message(self, opts, message): | |
recipient, memo = opts['RECIPIENT'], ' '.join(opts['INPUT']) | |
self.add_memo(recipient, memo) | |
message.response = "Remembered, I'll tell %(recipient)s when they're back." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment