Преглед на файлове

docstrings for BaseCommand

tags/v0.1
Ben Kurtovic преди 13 години
родител
ревизия
fc32e7c8aa
променени са 1 файла, в които са добавени 14 реда и са изтрити 5 реда
  1. +14
    -5
      irc/base_command.py

+ 14
- 5
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

Зареждане…
Отказ
Запис