2010-01-17 04:24:36 +00:00
|
|
|
from util import hook
|
|
|
|
|
|
|
|
@hook.command
|
2010-02-02 04:42:34 +00:00
|
|
|
def help(inp, bot=None, pm=None):
|
2010-01-17 04:24:36 +00:00
|
|
|
".help [command] -- gives a list of commands/help for a command"
|
|
|
|
|
|
|
|
funcs = {}
|
|
|
|
for csig, func, args in bot.plugs['command']:
|
|
|
|
if args['hook'] != r'(.*)':
|
|
|
|
if func.__doc__ is not None:
|
|
|
|
funcs[csig[1]] = func
|
|
|
|
|
2010-02-02 04:42:34 +00:00
|
|
|
if not inp:
|
|
|
|
pm('available commands: ' + ' '.join(sorted(funcs)))
|
2010-01-17 04:24:36 +00:00
|
|
|
else:
|
2010-02-02 04:42:34 +00:00
|
|
|
if inp in funcs:
|
|
|
|
pm(funcs[inp].__doc__)
|