-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_loader.py
53 lines (45 loc) · 1.23 KB
/
config_loader.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
config_loader.py
This module contains the Loader class
which is responsible for loading and modifying configuration files.
"""
import json
class Loader:
"""
A class used to load and modify configuration files.
Attributes
----------
owner : object
The owner object which contains the avatar attribute.
Methods
-------
load_config(name)
Loads the configuration file and modifies it with the owner's avatar.
"""
def __init__(self, owner):
"""
Parameters
----------
owner : object
The owner object which contains the avatar attribute.
"""
self.owner = owner
def load_config(self, name):
"""
Loads the configuration file and modifies it with the owner's avatar.
Parameters
----------
name : str
The name of the configuration to be loaded.
Returns
-------
dict
The modified configuration dictionary.
"""
with open("jsons/config.json") as f:
json_file = json.load(f)
try:
json_file["embed"]["embeds_footerpic"] = self.owner.avatar
except:
pass
return json_file[name]