From f943d63098a50746f4e470e403a991a4d9713030 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 29 Mar 2016 12:56:58 +0100 Subject: first commit. --- Config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Config.py (limited to 'Config.py') diff --git a/Config.py b/Config.py new file mode 100644 index 00000000..06a00378 --- /dev/null +++ b/Config.py @@ -0,0 +1,15 @@ +import json, os + +class Config(object): + def __init__(self, bot, location="bot.json"): + self.bot = bot + self.location = location + self.full_location = os.path.join(bot.bot_directory, + self.location) + self.bot.config = {} + self.load_config() + + 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()) -- cgit v1.3.1-10-gc9f91