fix help plugin
This commit is contained in:
parent
30baa6c49c
commit
60be1e7165
|
@ -6,13 +6,18 @@ def help(inp, bot=None, pm=None):
|
||||||
".help [command] -- gives a list of commands/help for a command"
|
".help [command] -- gives a list of commands/help for a command"
|
||||||
|
|
||||||
funcs = {}
|
funcs = {}
|
||||||
for csig, func, args in bot.plugs['command']:
|
for command, (func, args) in bot.commands.iteritems():
|
||||||
if args['hook'] != r'(.*)':
|
|
||||||
if func.__doc__ is not None:
|
if func.__doc__ is not None:
|
||||||
funcs[csig[1]] = func
|
if func in funcs:
|
||||||
|
if len(funcs[func]) < len(command):
|
||||||
|
funcs[func] = command
|
||||||
|
else:
|
||||||
|
funcs[func] = command
|
||||||
|
|
||||||
|
commands = dict((value, key) for key, value in funcs.iteritems())
|
||||||
|
|
||||||
if not inp:
|
if not inp:
|
||||||
pm('available commands: ' + ' '.join(sorted(funcs)))
|
pm('available commands: ' + ' '.join(sorted(commands)))
|
||||||
else:
|
else:
|
||||||
if inp in funcs:
|
if inp in commands:
|
||||||
pm(funcs[inp].__doc__)
|
pm(commands[inp].__doc__)
|
||||||
|
|
Loading…
Reference in New Issue