From 9b1336fb2c7409494d95ce63f2fe62acbee6bc25 Mon Sep 17 00:00:00 2001 From: fanyx Date: Wed, 24 Jan 2024 11:32:09 +0100 Subject: [PATCH] Ignore errors when reading config file LMAO --- main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 702529a..60eb928 100755 --- a/main.py +++ b/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()