From fc32e7c8aa6ae26e7c8a05b1d1ecad8a0be70616 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Tue, 19 Apr 2011 14:35:00 -0400 Subject: [PATCH] docstrings for BaseCommand --- irc/base_command.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/irc/base_command.py b/irc/base_command.py index 2e1f123..8713020 100644 --- a/irc/base_command.py +++ b/irc/base_command.py @@ -4,21 +4,30 @@ class BaseCommand(object): def __init__(self, connection): - """docstring""" + """A base class for commands on IRC.""" self.connection = connection def get_hook(self): - """Hooks are: 'msg', 'msg_private', 'msg_public', and 'join'.""" + """Hooks are: 'msg', 'msg_private', 'msg_public', and 'join'. Return + the hook you want this command to be called on.""" return None def get_help(self, command): - """docstring""" + """Return help information for the command, used by !help. return None + for no help. If a given class handles multiple commands, the command + variable can be used to return different help for each one.""" return None def check(self, data): - """docstring""" + """Given a Data() object, return True if we should respond to this + activity, or False if we should ignore it/it doesn't apply to us. Most + commands return True if data.command == 'command_name', otherwise + they return False.""" return False def process(self, data): - """docstring""" + """Handle an activity (usually a message) on IRC. At this point, thanks + to self.check() which is called automatically by command_handler, we + know this is something we should respond to, so (usually) a + 'if data.command != "command_name": return' is unnecessary.""" pass