diff options
| author | Kyomotoi <1172294279@qq.com> | 2020-08-24 18:09:04 +0800 | 
|---|---|---|
| committer | Kyomotoi <1172294279@qq.com> | 2020-08-24 18:09:04 +0800 | 
| commit | 27459db32dee5c70756aca40a4dfad8f7f90ad7b (patch) | |
| tree | 68660052a2b5b3f89745bb12aaa9099aa5245fb7 /ATRI/modules | |
| parent | c413c33b246bb49e31f070d781a8515bb61f7909 (diff) | |
| download | ATRI-27459db32dee5c70756aca40a4dfad8f7f90ad7b.tar.gz ATRI-27459db32dee5c70756aca40a4dfad8f7f90ad7b.tar.bz2 ATRI-27459db32dee5c70756aca40a4dfad8f7f90ad7b.zip | |
[Update]
Diffstat (limited to 'ATRI/modules')
| -rw-r--r-- | ATRI/modules/funcControl/__init__.py | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/ATRI/modules/funcControl/__init__.py b/ATRI/modules/funcControl/__init__.py new file mode 100644 index 0000000..65b4e58 --- /dev/null +++ b/ATRI/modules/funcControl/__init__.py @@ -0,0 +1,35 @@ +import json +from pathlib import Path +from typing import Optional + + +def checkSwitch(funcName: str): +    file = Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json' +    with open(file, 'r') as f: +        data = json.load(f) +     +    if data[funcName] == "on": +        return True + +def checkNoob(user: int, group: Optional[int] = None): +    fileU = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobList.json' +    fileG = Path('.') / 'ATRI' / 'plugins' / 'noobList' / 'noobGroup.json' +    try: +        with open(fileU, 'r') as f: +            dataU = json.load(f) +    except: +        dataU = {} +    try: +        with open(fileG, 'r') as f: +            dataG = json.load(f) +    except: +        dataG = {} + +    if str(user) not in dataU.keys(): +        if group: +            if str(group) not in dataG.keys(): +                return True +        else: +            return True +    else: +        pass
\ No newline at end of file | 
