-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot_json_data.py
32 lines (28 loc) · 1010 Bytes
/
bot_json_data.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
import json
class BotJsonData:
def __init__(self, logger, config):
self.logger = logger
self.config = config
self.ship_data = {}
self.luck_data = {}
def bot_json_data(self):
self.ship_data = {}
try:
with open('./ship_table.json', 'r', encoding="utf-8_sig") as fc:
self.ship_data = json.load(fc)
except json.JSONDecodeError as e:
self.logger.error(f'JSONDecodeError:{e}')
exit(e)
except FileNotFoundError as e:
self.logger.error(f'FileNotFoundError:{e}')
exit(e)
self.luck_data = {}
try:
with open('./luck_table.json', 'r', encoding="utf-8_sig") as fc:
self.luck_data = json.load(fc)
except json.JSONDecodeError as e:
self.logger.error(f'JSONDecodeError:{e}')
exit(e)
except FileNotFoundError as e:
self.logger.error(f'FileNotFoundError:{e}')
exit(e)