add ability to gather help text (#38)
parent
7d0844e156
commit
1523cfaf3a
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue