summaryrefslogtreecommitdiff
path: root/ATRI/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/modules')
-rw-r--r--ATRI/modules/funcControl/__init__.py35
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