diff --git a/pinhook/bot.py b/pinhook/bot.py index cdd8f46..1379a75 100644 --- a/pinhook/bot.py +++ b/pinhook/bot.py @@ -162,7 +162,7 @@ class Bot(irc.bot.SingleServerIRCBot): output = None if cmd in pinhook.plugin.cmds: try: - output = pinhook.plugin.cmds[cmd](self.Message( + output = pinhook.plugin.cmds[cmd]['run'](self.Message( channel=chan, cmd=cmd, nick_list=nick_list, diff --git a/pinhook/plugin.py b/pinhook/plugin.py index 6a6afb1..f94313e 100644 --- a/pinhook/plugin.py +++ b/pinhook/plugin.py @@ -30,8 +30,11 @@ def message(msg): return Output(OutputType.Message, msg) -def _add_plugin(command, func): - cmds[command] = func +def _add_plugin(command, help_text, func): + cmds[command] = { + 'run': func, + 'help': help_text + } def _add_listener(name, func): @@ -43,9 +46,9 @@ def clear_plugins(): lstnrs.clear() -def register(command): +def register(command, help_text=None): def register_for_command(func): - _add_plugin(command, func) + _add_plugin(command, help_text, func) return func return register_for_command