Added code to preprocess check a command that only requires authentication, not
a permission
This commit is contained in:
parent
054a98c0c8
commit
4da8a4ac39
1 changed files with 4 additions and 0 deletions
|
@ -87,6 +87,7 @@ class Module(object):
|
|||
|
||||
def preprocess_command(self, event):
|
||||
permission = event["hook"].kwargs.get("permission", None)
|
||||
authenticated = event["hook"].kwargs.get("authenticated", False)
|
||||
if permission:
|
||||
identified = event["user"].identified
|
||||
user_permissions = event["user"].get_setting("permissions", [])
|
||||
|
@ -94,6 +95,9 @@ class Module(object):
|
|||
permission in user_permissions or "*" in user_permissions)
|
||||
if not identified or not has_permission:
|
||||
return "You do not have permission to do that"
|
||||
elif authenticated:
|
||||
if not event["user"].identified:
|
||||
return "You need to be identified to use that command"
|
||||
|
||||
def my_permissions(self, event):
|
||||
permissions = event["user"].get_setting("permissions", [])
|
||||
|
|
Loading…
Reference in a new issue