add ability to gather help text (#38)
parent
7d0844e156
commit
1523cfaf3a
|
@ -162,7 +162,7 @@ class Bot(irc.bot.SingleServerIRCBot):
|
||||||
output = None
|
output = None
|
||||||
if cmd in pinhook.plugin.cmds:
|
if cmd in pinhook.plugin.cmds:
|
||||||
try:
|
try:
|
||||||
output = pinhook.plugin.cmds[cmd](self.Message(
|
output = pinhook.plugin.cmds[cmd]['run'](self.Message(
|
||||||
channel=chan,
|
channel=chan,
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
nick_list=nick_list,
|
nick_list=nick_list,
|
||||||
|
|
|
@ -30,8 +30,11 @@ def message(msg):
|
||||||
return Output(OutputType.Message, msg)
|
return Output(OutputType.Message, msg)
|
||||||
|
|
||||||
|
|
||||||
def _add_plugin(command, func):
|
def _add_plugin(command, help_text, func):
|
||||||
cmds[command] = func
|
cmds[command] = {
|
||||||
|
'run': func,
|
||||||
|
'help': help_text
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _add_listener(name, func):
|
def _add_listener(name, func):
|
||||||
|
@ -43,9 +46,9 @@ def clear_plugins():
|
||||||
lstnrs.clear()
|
lstnrs.clear()
|
||||||
|
|
||||||
|
|
||||||
def register(command):
|
def register(command, help_text=None):
|
||||||
def register_for_command(func):
|
def register_for_command(func):
|
||||||
_add_plugin(command, func)
|
_add_plugin(command, help_text, func)
|
||||||
return func
|
return func
|
||||||
return register_for_command
|
return register_for_command
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue