diff --git a/decorators.py b/decorators.py index 5ef6635..ef564bd 100644 --- a/decorators.py +++ b/decorators.py @@ -12,7 +12,7 @@ from oyoyo.parse import parse_nick import fnmatch import botconfig -def generate(fdict, **kwargs): +def generate(fdict, permissions=True, **kwargs): """Generates a decorator generator. Always use this""" def cmd(*s, raw_nick=False, admin_only=False, owner_only=False, id=-1): def dec(f): @@ -25,6 +25,8 @@ def generate(fdict, **kwargs): if not raw_nick and largs[1]: largs[1] = parse_nick(largs[1])[0] # username #if largs[1].startswith("#"): + if not permissions or "" in s: + return f(*largs) if cloak: for pattern in botconfig.DENY.keys(): if fnmatch.fnmatch(cloak, pattern): @@ -39,14 +41,14 @@ def generate(fdict, **kwargs): return f(*largs) # no questions if owner_only: if cloak and [ptn for ptn in botconfig.OWNERS - if fnmatch.fnmatch(cloak, ptn)]: + if fnmatch.fnmatch(cloak, ptn)]: return f(*largs) elif cloak: largs[0].notice(largs[1], "You are not the owner.") return if admin_only: - if cloak and [ptn for ptn in botconfig.OWNERS - if fnmatch.fnmatch(cloak, ptn)]: + if cloak and [ptn for ptn in botconfig.ADMINS+botconfig.OWNERS + if fnmatch.fnmatch(cloak, ptn)]: return f(*largs) elif cloak: largs[0].notice(largs[1], "You are not an admin.") diff --git a/wolfgame.py b/wolfgame.py index 6acc450..41e0465 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -31,7 +31,7 @@ HOOKS = {} cmd = decorators.generate(COMMANDS) pmcmd = decorators.generate(PM_COMMANDS) -hook = decorators.generate(HOOKS, raw_nick=True) +hook = decorators.generate(HOOKS, raw_nick=True, permissions=False) # Game Logic Begins: @@ -422,8 +422,6 @@ def stats(cli, nick, chan, rest): l2 = [k for k in var.ORIGINAL_ROLES.keys() if var.ORIGINAL_ROLES[k]] rs = list(set(l1+l2)) - if "village drunk" in rs: - rs.remove("village drunk") # drunk is not displayed # Due to popular demand, picky ordering if "wolf" in rs: