|
@@ -4,21 +4,30 @@ |
|
|
|
|
|
|
|
|
class BaseCommand(object): |
|
|
class BaseCommand(object): |
|
|
def __init__(self, connection): |
|
|
def __init__(self, connection): |
|
|
"""docstring""" |
|
|
|
|
|
|
|
|
"""A base class for commands on IRC.""" |
|
|
self.connection = connection |
|
|
self.connection = connection |
|
|
|
|
|
|
|
|
def get_hook(self): |
|
|
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 |
|
|
return None |
|
|
|
|
|
|
|
|
def get_help(self, command): |
|
|
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 |
|
|
return None |
|
|
|
|
|
|
|
|
def check(self, data): |
|
|
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 |
|
|
return False |
|
|
|
|
|
|
|
|
def process(self, data): |
|
|
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 |
|
|
pass |