blob: 65b4e58d0d546627c7eb294e0fe710be4d777422 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|