blob: f4dac2681c55fe3184bf41176d49a0bac22437cd (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import os
import json
from pathlib import Path
from typing import Optional
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] == "off":
return False
else:
try:
file = Path('.') / 'ATRI' / 'data' / 'groupData' / f'{g}' / 'switch.json'
with open(file, 'r') as f:
data = json.load(f)
except:
try:
os.mkdir(Path('.') / 'ATRI' / 'data' / 'groupData' / f'{g}')
except:
pass
data = {}
data["pixiv_seach_img"] = "on"
data["pixiv_seach_author"] = "on"
data["pixiv_daily_rank"] = "on"
data["setu"] = "on"
data["setu_img"] = "on"
data["anime_search"] = "on"
data["change_face"] = "on"
data["chouYou"] = "on"
data["saucenao_search"] = "on"
with open(Path('.') / 'ATRI' / 'data' / 'groupData' / f'{g}' / 'switch.json', 'w') as f:
f.write(json.dumps(data))
f.close()
if data[funcName] == "on":
return True
def checkNoob(u: int, g: 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(u) not in dataU.keys():
if g:
if str(g) not in dataG.keys():
return True
else:
return True
else:
pass
|