From e06d5f37f8912802d2937cc73d99942e6cb21ea4 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 16 Jul 2018 00:36:52 +0100 Subject: switch to using configparser for config files --- Config.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Config.py') diff --git a/Config.py b/Config.py index 06a00378..21a144cf 100644 --- a/Config.py +++ b/Config.py @@ -1,7 +1,7 @@ -import json, os +import configparser, os class Config(object): - def __init__(self, bot, location="bot.json"): + def __init__(self, bot, location="bot.conf"): self.bot = bot self.location = location self.full_location = os.path.join(bot.bot_directory, @@ -12,4 +12,6 @@ class Config(object): def load_config(self): if os.path.isfile(self.full_location): with open(self.full_location) as config_file: - self.bot.config = json.loads(config_file.read()) + parser = configparser.ConfigParser() + parser.read_string(config_file.read()) + self.bot.config = dict(parser["bot"].items()) -- cgit v1.3.1-10-gc9f91