replace-bot/configs/configure.py

33 lines
705 B
Python
Raw Normal View History

2022-02-16 18:13:44 +03:00
from configparser import ConfigParser
from .module import Config
CONFIG_FILE = 'config.ini'
class Configure(Config):
def __init__(self):
self.config = ConfigParser()
self.data = dict()
self.__readconfig()
def __readconfig(self):
self.config.read(CONFIG_FILE)
for section in self.config.sections():
self.data[section] = dict()
for (key, value) in self.config.items(section):
self.data[section][key] = value
def bot(self, key):
return self.data["Bot"][key]
def db(self, key):
return self.data["DataBase"][key]
def anons(self, key):
return self.data["announcements"][key]