diff --git a/module.py b/module.py index 03fb0bd..fa2bbbc 100755 --- a/module.py +++ b/module.py @@ -154,11 +154,8 @@ def require_privilege(level, message=None): user does not have the privilege, `message` will be said if given. If it is a private message, no checking will be done. """ - def add_attribute(function): - function.priv = level - return add_attribute - def actual_decorator(function): + function.priv = level @functools.wraps(function) def guarded(bot, trigger, *args, **kwargs): # If this is a privmsg, ignore privilege requirements @@ -172,7 +169,7 @@ def require_privilege(level, message=None): else: return function(bot, trigger, *args, **kwargs) return guarded - return add_attribute(actual_decorator) + return actual_decorator def require_admin(message=None): @@ -252,3 +249,4 @@ def url_callback(url): function.url_callback.append(url) return function return add_attribute + \ No newline at end of file diff --git a/modules/help.py b/modules/help.py index d5deb62..d921b9a 100755 --- a/modules/help.py +++ b/modules/help.py @@ -35,7 +35,8 @@ def help(bot, trigger): elif trigger.admin: cmds = [cmd for _, cmd in bot.commands.items() if cmd.priv <= 5] else: - cmds = [cmd for _, cmd in bot.commands.items() if cmd.priv < 5] + priv = bot.channels[trigger.channel].privileges[trigger.nick] + cmds = [cmd for _, cmd in bot.commands.items() if cmd.priv <= priv] cmds = [cmd.name for cmd in cmds if cmd.canonical] cmds = sorted(cmds)