Ignore errors when reading config file LMAO
This commit is contained in:
parent
7275c83e98
commit
9b1336fb2c
9
main.py
9
main.py
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/env python3
|
#!/bin/env python3
|
||||||
from typing import Literal, Optional
|
from typing import Literal, Optional
|
||||||
from yaml import safe_load
|
from yaml import safe_load
|
||||||
|
import os
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
@ -18,8 +19,12 @@ class Bot(commands.Bot):
|
||||||
self.add_view(RoleSelectView())
|
self.add_view(RoleSelectView())
|
||||||
return await super().setup_hook()
|
return await super().setup_hook()
|
||||||
|
|
||||||
with open('config.yaml', 'r') as file:
|
for loc in os.curdir, "/etc/salzarbeiter", os.environ.get("CFG_FILE"):
|
||||||
config = safe_load(file)
|
try:
|
||||||
|
with open(os.path.join(loc, "config.yaml"), "r") as file:
|
||||||
|
config = safe_load(file)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# Bot
|
# Bot
|
||||||
client = Bot()
|
client = Bot()
|
||||||
|
|
Loading…
Reference in New Issue