From a24da5f5d130d0678fa7b672a24632cbba102057 Mon Sep 17 00:00:00 2001 From: rainyday Date: Mon, 22 Nov 2010 11:12:59 +0800 Subject: [PATCH] Changed help to not display commands from disabled plugins. --- plugins/help.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/help.py b/plugins/help.py index 4da5b45..27bc545 100644 --- a/plugins/help.py +++ b/plugins/help.py @@ -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())