summaryrefslogtreecommitdiff
path: root/ATRI/modules/funcControl
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-09-06 16:26:49 +0800
committerKyomotoi <[email protected]>2020-09-06 16:26:49 +0800
commitb5eaf0283065673389ecf997541d217cf7fc7541 (patch)
tree4f37746e2971f45f05612ccd0e0bac4432346f47 /ATRI/modules/funcControl
parenta36b6ecc37491b5cbf8c8750d252fbd53dc301ca (diff)
downloadATRI-b5eaf0283065673389ecf997541d217cf7fc7541.tar.gz
ATRI-b5eaf0283065673389ecf997541d217cf7fc7541.tar.bz2
ATRI-b5eaf0283065673389ecf997541d217cf7fc7541.zip
[Update]
Diffstat (limited to 'ATRI/modules/funcControl')
-rw-r--r--ATRI/modules/funcControl/ALLswitch.json1
-rw-r--r--ATRI/modules/funcControl/__init__.py12
2 files changed, 10 insertions, 3 deletions
diff --git a/ATRI/modules/funcControl/ALLswitch.json b/ATRI/modules/funcControl/ALLswitch.json
new file mode 100644
index 0000000..1b87087
--- /dev/null
+++ b/ATRI/modules/funcControl/ALLswitch.json
@@ -0,0 +1 @@
+{"pixiv_seach_img": "on", "pixiv_seach_author": "on", "pixiv_daily_rank": "on", "setu": "on", "setu_img": "off", "anime_search": "on", "change_face": "on", "chouYou": "on", "saucenao_search": "on"} \ No newline at end of file
diff --git a/ATRI/modules/funcControl/__init__.py b/ATRI/modules/funcControl/__init__.py
index f8e9259..c111b61 100644
--- a/ATRI/modules/funcControl/__init__.py
+++ b/ATRI/modules/funcControl/__init__.py
@@ -3,13 +3,19 @@ from pathlib import Path
from typing import Optional
-def checkSwitch(funcName: str):
- file = Path('.') / 'ATRI' / 'plugins' / 'switch' / 'switch.json'
+def checkSwitch(funcName: str, g: int):
+ file = Path('.') / 'ATRI' / 'modules' / 'funcControl' / 'ALLswitch.json'
with open(file, 'r') as f:
data = json.load(f)
-
if data[funcName] == "on":
return True
+ else:
+ file = Path('.') / 'ATRI' / 'data' / 'groupData' / f'{g}' / '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'