From 52b127021188c95a1283aafae77764ef8d19a3af Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 15 Mar 2003 12:39:46 +0000 Subject: [PATCH] Removed __init__ and created _revcode more naturally. Also added some morehelp strings. --- plugins/Moobot.py | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/plugins/Moobot.py b/plugins/Moobot.py index 56df20d7a..f245b82c4 100644 --- a/plugins/Moobot.py +++ b/plugins/Moobot.py @@ -44,15 +44,11 @@ import privmsgs import callbacks class Moobot(callbacks.Privmsg): - def __init__(self): - super(self.__class__, self).__init__() - #callbacks.Privmsg.__init__(self) - if not self._revcode: - for (k, v) in self._code.iteritems(): - self._revcode[v.strip()] = k - def cool(self, irc, msg, args): - "" + """ + + Says something's cool. Yeah. :cool: Supybot :cool: :) + """ something = privmsgs.getArgs(args) irc.reply(msg, ':cool: %s :cool:' % something) @@ -99,10 +95,13 @@ class Moobot(callbacks.Privmsg): " " : " " } - _revcode = {} + _revcode = dict([(y.strip(), x) for (x, y) in _code.items()]) def unmorse(self, irc, msg, args): - "" + """ + + Does the reverse of the morse/ditdaw command. + """ text = privmsgs.getArgs(args) L = [] for code in text.split(): @@ -113,7 +112,10 @@ class Moobot(callbacks.Privmsg): irc.reply(msg, ''.join(L)) def morse(self, irc, msg, args): - "" + """ + + Gives the more code equivalent of a given string. + """ text = privmsgs.getArgs(args) L = [] for c in text.upper(): @@ -137,7 +139,11 @@ class Moobot(callbacks.Privmsg): irc.reply(msg, ''.join(L)) def mime(self, irc, msg, args): - "" + """ + + Encodes text in base64. Here for compatibility with Moobot; this and + other encodings are available in the FunCommands module. + """ text = privmsgs.getArgs(args) s = base64.encodestring(text).strip() if ircutils.validArgument(s): @@ -147,7 +153,11 @@ class Moobot(callbacks.Privmsg): 'Try a smaller string.') def unmime(self, irc, msg, args): - "" + """ + + Decodes base64 encoded text. Here for compatibility with Moobot; this + and other encodings are available in the FunCommands module. + """ text = privmsgs.getArgs(args) s = base64.decodestring(text) if ircutils.validArgument(s): @@ -157,7 +167,12 @@ class Moobot(callbacks.Privmsg): _stack = [] def stack(self, irc, msg, args): - "<'push'|'pop'|'size'|'xray'> " + """<'push'|'pop'|'size'|'xray'> + + Maintains a stack of various strings; push pushes onto the stack, + pop pops off it, size gives its current size, and xray takes an + index into the stack and gives that element. + """ (command, value) = privmsgs.getArgs(args, optional=1) if command == 'pop': if self._stack: