Sledgehammer config approach

This commit is contained in:
Logan Cusano
2022-11-26 20:18:42 -05:00
parent b2a73726a0
commit f36c73b30b
2 changed files with 20 additions and 12 deletions

View File

@@ -53,20 +53,24 @@ def read_config_file():
config = configparser.ConfigParser()
config.read('./config.ini')
config_return = {
'Bot Token': config['Bot_Info']['Token'],
'Device ID': int(config['Device']['ID']),
'Device Name': str(config['Device']['Name']),
'Mention Group': str(config['Bot_Info']['Mention_Group']),
'Channel ID': int(config['Bot_Info']['Channel_ID']),
'Handler': str(config['Config']['Handler'])
}
try:
config_return = {
'Bot Token': config['Bot_Info']['Token'],
'Device ID': int(config['Device']['ID']),
'Device Name': str(config['Device']['Name']),
'Mention Group': str(config['Bot_Info']['Mention_Group']),
'Channel ID': int(config['Bot_Info']['Channel_ID']),
'Handler': str(config['Config']['Handler'])
}
LOGGER.debug("Found config options:")
for key in config_return.keys():
LOGGER.debug(f"\t{key} : {config_return[key]}")
LOGGER.debug("Found config options:")
for key in config_return.keys():
LOGGER.debug(f"\t{key} : {config_return[key]}")
return config_return
return config_return
except Exception as err:
LOGGER.warning(err)
return None
def write_config_file(**kwargs):