add yml config option

This commit is contained in:
CramMK
2020-02-12 16:58:01 +01:00
parent 1251b915d9
commit 05d2829bae
2 changed files with 21 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
token: ''
prefix: ''
...

View File

@@ -1,13 +1,26 @@
"""
Gather all config data into one file
Gather all config data into one file,
so all other files can call it from here
loadconfig.py then gets called in aquabot.py
"""
# IMPORTS
import yaml
# Variable Gathering
__avatar__ = "https://i.imgur.com/mskM9dH.png"
try:
# TODO Maybe use yaml for token and prefix!
with open("config/config.yml") as file:
config = yaml.safe_load(file)
for yml_entry in config:
__token__ = config[yml_entry]['token']
__prefix__ = config[yml_entry]['prefix']
except yaml.YAMLError as error:
print(f"Error while parsing: {error}")
try:
from config.config import __token__, __prefix__
from config.cogs import __cogs__
from config.status import __activity__