Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 24 lines (18 sloc) 0.677 kb
c183032 Fix unintentional changes to plugin directory structure.
Hamled authored
1 from util import hook
2
253881f @rmmh PEP8 compliance + clean dotnetpad
authored
3
6452c11 @rmmh disable !command, enable fuzzy command matching, make help automatic, ad...
authored
4 @hook.command(autohelp=False)
1dd86ba @rmmh change calling convention
authored
5 def help(inp, bot=None, pm=None):
c183032 Fix unintentional changes to plugin directory structure.
Hamled authored
6 ".help [command] -- gives a list of commands/help for a command"
253881f @rmmh PEP8 compliance + clean dotnetpad
authored
7
c183032 Fix unintentional changes to plugin directory structure.
Hamled authored
8 funcs = {}
60be1e7 @rmmh fix help plugin
authored
9 for command, (func, args) in bot.commands.iteritems():
10 if func.__doc__ is not None:
11 if func in funcs:
12 if len(funcs[func]) < len(command):
13 funcs[func] = command
14 else:
15 funcs[func] = command
16
17 commands = dict((value, key) for key, value in funcs.iteritems())
c183032 Fix unintentional changes to plugin directory structure.
Hamled authored
18
1dd86ba @rmmh change calling convention
authored
19 if not inp:
60be1e7 @rmmh fix help plugin
authored
20 pm('available commands: ' + ' '.join(sorted(commands)))
c183032 Fix unintentional changes to plugin directory structure.
Hamled authored
21 else:
60be1e7 @rmmh fix help plugin
authored
22 if inp in commands:
23 pm(commands[inp].__doc__)
Something went wrong with that request. Please try again.