ModInfo — Module command help system

Implements global help and helpindex commands that print help information about all available modules. Modules must import and use a decorator from this module. For example:

from pyircbot.modules.ModInfo import info

# ...

@info("help [command]", "show the manual for all or [commands]", cmds=["help"])
@command("help")
def cmd_help(self, msg, cmd):
    # ...

The info decorator takes mandatory string parameters describing the command. The first is an argspec; simply the name of the command with parameters marked using < and >. Optional parameters should be encased in [`square brackets]`. The second parameter is a short text description of the command. The third, optional, list parameter cmds is a list of short names thart are aliases for the function that aide in help lookup. In all cases, the cases, commands will be prefixed with the default command prefix (from pyircbot.modulebase.command.prefix).

Class Reference

class pyircbot.modules.ModInfo.ModInfo(bot, moduleName)[source]

Bases: pyircbot.modulebase.ModuleBase

cmd_help(msg, cmd)[source]

Get help on a command

cmd_helpindex(msg, cmd)[source]

Short index of commands

iter_modules()[source]

Iterator that cycles through module methods that are tagged with help information. The iterator yields tuples of:

(module_name, module_object, command_spec, command_help, command_alias_list)

send_columnized(channel, rows)[source]
class pyircbot.modules.ModInfo.info(cmdspec, docstring, cmds=None)[source]

Bases: object

Decorator for tagging module methods with help text

Parameters:
  • docstring (str) – command help formatted as above
  • cmds – enable command names or aliases this function implements, as a list of strings. E.g. if the “help”

command has the alias “rtfm” :type cmds: list