2018-07-15 23:36:52 +00:00
|
|
|
import configparser, os
|
2016-03-29 11:56:58 +00:00
|
|
|
|
|
|
|
class Config(object):
|
2018-07-15 23:36:52 +00:00
|
|
|
def __init__(self, bot, location="bot.conf"):
|
2016-03-29 11:56:58 +00:00
|
|
|
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:
|
2018-07-15 23:36:52 +00:00
|
|
|
parser = configparser.ConfigParser()
|
|
|
|
parser.read_string(config_file.read())
|
2018-08-30 10:40:41 +00:00
|
|
|
return dict(parser["bot"].items())
|