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
|
||||
from typing import Literal, Optional
|
||||
from yaml import safe_load
|
||||
import os
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
@ -18,8 +19,12 @@ class Bot(commands.Bot):
|
|||
self.add_view(RoleSelectView())
|
||||
return await super().setup_hook()
|
||||
|
||||
with open('config.yaml', 'r') as file:
|
||||
config = safe_load(file)
|
||||
for loc in os.curdir, "/etc/salzarbeiter", os.environ.get("CFG_FILE"):
|
||||
try:
|
||||
with open(os.path.join(loc, "config.yaml"), "r") as file:
|
||||
config = safe_load(file)
|
||||
except:
|
||||
pass
|
||||
|
||||
# Bot
|
||||
client = Bot()
|
||||
|
|
Loading…
Reference in New Issue