From 525aea3f05af8599f06e2f17f1aa4e62fa8bc04c Mon Sep 17 00:00:00 2001 From: Kumi Date: Sun, 18 Aug 2024 10:50:27 +0200 Subject: [PATCH] fix(config): add fallback values for Matrix config checks Added fallback values for Matrix 'Password' and 'UserID' config checks to prevent exceptions when these keys are not present. This ensures smoother handling of missing configurations. --- src/gptbot/classes/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gptbot/classes/bot.py b/src/gptbot/classes/bot.py index 9a1eb67..f39ff5a 100644 --- a/src/gptbot/classes/bot.py +++ b/src/gptbot/classes/bot.py @@ -241,8 +241,8 @@ class GPTBot: homeserver = config["Matrix"]["Homeserver"] - if config.get("Matrix", "Password"): - if not config.get("Matrix", "UserID"): + if config.get("Matrix", "Password", fallback=""): + if not config.get("Matrix", "UserID", fallback=""): raise Exception("Cannot log in: UserID not set in config") bot.matrix_client = AsyncClient(homeserver, user=config["Matrix"]["UserID"])