Changed help to not display commands from disabled plugins.

This commit is contained in:
rainyday 2010-11-22 11:12:59 +08:00 committed by rmmh
parent a4f7b4ac43
commit a24da5f5d1
1 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,5 @@
import re
from util import hook
@ -7,12 +9,15 @@ def help(inp, bot=None, pm=None):
funcs = {}
for command, (func, args) in bot.commands.iteritems():
if func.__doc__ is not None:
if func in funcs:
if len(funcs[func]) < len(command):
fn = re.match(r'^plugins.(.+).py$', func._filename)
disabled = bot.config.get('disabled_plugins', [])
if fn.group(1).lower() not in disabled:
if func.__doc__ is not None:
if func in funcs:
if len(funcs[func]) < len(command):
funcs[func] = command
else:
funcs[func] = command
else:
funcs[func] = command
commands = dict((value, key) for key, value in funcs.iteritems())