mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
test
This commit is contained in:
parent
59260fa977
commit
155afcb25e
@ -13,9 +13,10 @@ class BotConfig():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.dict = {}
|
self.dict = {}
|
||||||
self.config = self.load_config()
|
self.config = self.load_config()
|
||||||
self.config_dict = self.config_file_to_dict()
|
|
||||||
|
|
||||||
def load_config(self):
|
def load_config(self):
|
||||||
|
|
||||||
|
# Load config
|
||||||
if not len(sys.argv[1:]):
|
if not len(sys.argv[1:]):
|
||||||
argv = ['legacy']
|
argv = ['legacy']
|
||||||
else:
|
else:
|
||||||
@ -23,19 +24,18 @@ class BotConfig():
|
|||||||
parser = build_parser()
|
parser = build_parser()
|
||||||
opts = parser.parse_args(argv)
|
opts = parser.parse_args(argv)
|
||||||
config_module = get_configuration(opts)
|
config_module = get_configuration(opts)
|
||||||
return config_module
|
|
||||||
|
|
||||||
def config_file_to_dict(self):
|
# load dict
|
||||||
configdict = dict()
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(self.config.filename)
|
config.read(self.config.filename)
|
||||||
for each_section in config.sections():
|
for each_section in config.sections():
|
||||||
if each_section not in configdict.keys():
|
if each_section not in self.dict.keys():
|
||||||
configdict[each_section] = dict()
|
self.dict[each_section] = dict()
|
||||||
for (each_key, each_val) in config.items(each_section):
|
for (each_key, each_val) in config.items(each_section):
|
||||||
if each_key not in configdict[each_section].keys():
|
if each_key not in self.dict[each_section].keys():
|
||||||
configdict[each_section][each_key] = each_val
|
self.dict[each_section][each_key] = each_val
|
||||||
return configdict
|
|
||||||
|
return config_module
|
||||||
|
|
||||||
|
|
||||||
botconfig = BotConfig()
|
botconfig = BotConfig()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user