aboutsummaryrefslogtreecommitdiff
path: root/src/Config.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-27 11:07:29 +0100
committerGravatar jesopo2018-09-27 11:07:29 +0100
commitaf2b34b92b30aa5a51d385e6137f0716dd7a7935 (patch)
treea96f5ab92678ebad022b53fd5fac0b068db1f009 /src/Config.py
parentFix event typo in greeting.py ("recevied" -> "received") (diff)
Don't give IRCBot instance to things that don't need it, use a better way of
doing default locations for config/database/log
Diffstat (limited to 'src/Config.py')
-rw-r--r--src/Config.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Config.py b/src/Config.py
index 71e01871..bf597b78 100644
--- a/src/Config.py
+++ b/src/Config.py
@@ -1,16 +1,12 @@
import configparser, os
class Config(object):
- def __init__(self, bot, directory, filename="bot.conf"):
- self.bot = bot
- self.filename = filename
- self.full_location = os.path.join(directory, filename)
- self.bot.config = {}
- self.load_config()
+ def __init__(self, location):
+ self.location = location
def load_config(self):
- if os.path.isfile(self.full_location):
- with open(self.full_location) as config_file:
+ if os.path.isfile(self.location):
+ with open(self.location) as config_file:
parser = configparser.ConfigParser()
parser.read_string(config_file.read())
return dict(parser["bot"].items())