bitbot-3.11-fork/src/Config.py

17 lines
575 B
Python
Raw Normal View History

import configparser, os
2016-03-29 11:56:58 +00:00
class Config(object):
def __init__(self, bot, directory, filename="bot.conf"):
2016-03-29 11:56:58 +00:00
self.bot = bot
self.filename = filename
self.full_location = os.path.join(directory, filename)
2016-03-29 11:56:58 +00:00
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:
parser = configparser.ConfigParser()
parser.read_string(config_file.read())
return dict(parser["bot"].items())