Browse Source

tools/decorators.py

pull/1/head
Jeebeevee 10 years ago
parent
commit
b66200ff52
  1. 8
      tools/decorators.py

8
tools/decorators.py

@ -37,7 +37,7 @@ def generate(fdict, permissions=True, **kwargs):
if fnmatch.fnmatch(cloak.lower(), pattern.lower()): if fnmatch.fnmatch(cloak.lower(), pattern.lower()):
for cmdname in s: for cmdname in s:
if cmdname in botconfig.DENY[pattern]: if cmdname in botconfig.DENY[pattern]:
largs[0].notice(nick, "You do not have permission to use that command.") largs[0].notice(nick, "Je hebt geen rechten voor dat commando.")
return return
for pattern in botconfig.ALLOW.keys(): for pattern in botconfig.ALLOW.keys():
if fnmatch.fnmatch(cloak.lower(), pattern.lower()): if fnmatch.fnmatch(cloak.lower(), pattern.lower()):
@ -49,14 +49,14 @@ def generate(fdict, permissions=True, **kwargs):
if fnmatch.fnmatch(cloak.lower(), ptn.lower())]: if fnmatch.fnmatch(cloak.lower(), ptn.lower())]:
return f(*largs) return f(*largs)
elif cloak: elif cloak:
largs[0].notice(nick, "You are not the owner.") largs[0].notice(nick, "Je bent niet de eigenaar.")
return return
if admin_only: if admin_only:
if cloak and [ptn for ptn in botconfig.ADMINS+botconfig.OWNERS if cloak and [ptn for ptn in botconfig.ADMINS+botconfig.OWNERS
if fnmatch.fnmatch(cloak.lower(), ptn.lower())]: if fnmatch.fnmatch(cloak.lower(), ptn.lower())]:
return f(*largs) return f(*largs)
elif cloak: elif cloak:
largs[0].notice(nick, "You are not an admin.") largs[0].notice(nick, "Je bent geen administrator.")
return return
return f(*largs) return f(*largs)
alias = False alias = False
@ -68,7 +68,7 @@ def generate(fdict, permissions=True, **kwargs):
for fn in fdict[x]: for fn in fdict[x]:
if (fn.owner_only != owner_only or if (fn.owner_only != owner_only or
fn.admin_only != admin_only): fn.admin_only != admin_only):
raise Exception("Command: "+x+" has non-matching protection levels!") raise Exception("Commando: "+x+" heeft geen passende beschermingsniveau!")
fdict[x].append(innerf) fdict[x].append(innerf)
if alias: if alias:
innerf.aliases.append(x) innerf.aliases.append(x)

Loading…
Cancel
Save