generated from tema/telegram-bot-template
26 lines
552 B
Python
26 lines
552 B
Python
from configparser import ConfigParser
|
|
|
|
from easydict import EasyDict as edict
|
|
|
|
|
|
CONFIG_FILE = 'config.ini'
|
|
|
|
data = ConfigParser()
|
|
data.read(CONFIG_FILE)
|
|
|
|
config = edict()
|
|
|
|
for section in data.sections():
|
|
config[section] = edict()
|
|
|
|
for key, value in data.items(section):
|
|
config[section][key] = value
|
|
|
|
|
|
def parse_bool(section=None, key=None, text=None):
|
|
if text is not None:
|
|
return text.lower() in ['yes', 'true']
|
|
|
|
if section is not None and key is not None:
|
|
return config[section][key].lower() in ['yes', 'true']
|