blob: 71e018710abeb795d6f6fb5d58bd14919f2637a2 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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 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())
|