forked from Dylan-Zheng/Rise-of-Kingdoms-Bot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
37 lines (27 loc) · 905 Bytes
/
config.py
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
import json
from utils import resource_path
HAO_I = 'haoi'
TWO_CAPTCHA = '2captcha'
NONE = 'none'
def load_config():
config = None
try:
with open(resource_path('config.json')) as f:
config_json = json.load(f)
config = Config(config_json)
except Exception as e:
config = Config({})
write_config(config)
return config
def write_config(config):
config_json = json.dumps(config.__dict__)
with open(resource_path("config.json"), 'w') as f:
f.write(config_json)
class Config:
def __init__(self, config={}):
self.screenSize = config.get('screenSize', [470, 850])
self.method = config.get('method', NONE)
self.haoiUser = config.get('haoiUser', None)
self.haoiRebate = config.get('haoiRebate', None)
self.twocaptchaKey = config.get('twocaptchaKey', None)
global_config = Config()