Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # lockfuncs.py
- def decrypt(accessor, target, *args, **kwargs):
- if args: # we've been provided a password
- password = args[0]
- if hasattr(accessor, "db"):
- # first we check if the accessing object has the password for the target
- if type(accessor.db.__channel_passwords) is dict:
- password_matches = accessor.db.__channel_passwords.get(target) == password
- else:
- accessor.db.__channel_passwords = {}
- password_matches = False
- # next we'll see if they pass a skill check
- # assuming Ainneve-style skills - please replace with whatever works
- if not hasattr(accessor, "skills"): # just in case we don't have a skills attribute
- return password_matches
- return password_matches or accessor.skills.decryption > 5
- else: # we don't have a typeclassed object
- return False
- else: # we don't have a password on this message
- return True
Advertisement
Add Comment
Please, Sign In to add comment