Ignore errors when reading config file LMAO

This commit is contained in:
fanyx 2024-01-24 11:32:09 +01:00
parent 7275c83e98
commit 9b1336fb2c
1 changed files with 7 additions and 2 deletions

View File

@ -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()