Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/config/__init__.py

23 lines
484 B
Python
Raw Normal View History

2021-02-19 10:13:31 +00:00
from configparser import ConfigParser
2021-03-21 08:14:28 +00:00
from os.path import abspath
2021-02-19 10:13:31 +00:00
2021-02-19 12:18:47 +00:00
2021-03-21 08:14:28 +00:00
config_filename = 'config.cfg'
2021-04-08 12:54:36 +00:00
config_path = abspath('./config/' + config_filename)
2021-03-21 08:14:28 +00:00
2021-04-08 12:52:51 +00:00
class CFG:
2021-03-21 08:14:28 +00:00
def config(self, q):
cp = ConfigParser()
cp.read(config_path)
section = cp.sections()[0]
value = cp.get(section, q)
if value.upper() == 'TRUE':
return True
if value.upper() == 'FALSE':
return False
return value
2021-04-08 12:52:51 +00:00
Config = CFG().config