From ee3dde97226a164f76c8f1f322afa4190304ad7c Mon Sep 17 00:00:00 2001 From: "FunnyMan3595 (Charlie Nolan)" Date: Wed, 30 Jul 2008 17:45:10 -0500 Subject: [PATCH] $set-perm --- basic_commands.py | 15 +++++++++++++++ perms.py | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/basic_commands.py b/basic_commands.py index ad5a9c3..4641ca9 100644 --- a/basic_commands.py +++ b/basic_commands.py @@ -118,6 +118,21 @@ def unignore(who, where, args): reply(who, where, "I wasn't ignoring them.") commands['unignore'] = (perms.ircop, unignore) +def set_perm(who, where, args): + "$set-perm : Sets a user's minimum Hal permission level. The user must be identified with NickServ to gain the extra permissions. Available levels: none, halfop, op, admin, owner, ircop" + split = args.split() + if len(split) != 2: + reply(who, where, "Usage: $set-perm ") + return + target, level_name = split + level = perms.Perms.from_name(level_name) + if level.name != level_name.lower(): + reply(who, where, "Available levels: none, halfop, op, admin, owner, ircop") + return + globals.my_users[target] = level + reply(who, where, "%s's minimum permission level is now %s." % (target, level)) +commands["set-perm"] = (perms.ircop, set_perm) + def tell_commands(who, where, args, user_perms): "$commands: Shows you all the stuff you can do." command_list = [command for command in commands diff --git a/perms.py b/perms.py index 08638c1..16ecc33 100644 --- a/perms.py +++ b/perms.py @@ -22,6 +22,10 @@ class Perms(object): def from_symbol(symbol): return Perms.symbols.get(symbol, Perms(0)) from_symbol = staticmethod(from_symbol) + #@staticmethod + def from_name(name): + return Perms.names.get(name.lower(), Perms(0)) + from_name = staticmethod(from_name) ban = Perms(-2, None, "banned") none = Perms(-1, None, "none") present = Perms(0, None, "present") # Default for from_symbol, albeit == not is. -- 2.11.4.GIT