h/plugins/help.py

19 lines
470 B
Python
Raw Normal View History

from util import hook
2010-03-01 02:32:41 +00:00
@hook.command
2010-02-02 04:42:34 +00:00
def help(inp, bot=None, pm=None):
".help [command] -- gives a list of commands/help for a command"
2010-03-01 02:32:41 +00:00
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)))
else:
2010-02-02 04:42:34 +00:00
if inp in funcs:
pm(funcs[inp].__doc__)