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.
This commit is contained in:
parent
99d3974e17
commit
525aea3f05
1 changed files with 2 additions and 2 deletions
|
@ -241,8 +241,8 @@ class GPTBot:
|
||||||
|
|
||||||
homeserver = config["Matrix"]["Homeserver"]
|
homeserver = config["Matrix"]["Homeserver"]
|
||||||
|
|
||||||
if config.get("Matrix", "Password"):
|
if config.get("Matrix", "Password", fallback=""):
|
||||||
if not config.get("Matrix", "UserID"):
|
if not config.get("Matrix", "UserID", fallback=""):
|
||||||
raise Exception("Cannot log in: UserID not set in config")
|
raise Exception("Cannot log in: UserID not set in config")
|
||||||
|
|
||||||
bot.matrix_client = AsyncClient(homeserver, user=config["Matrix"]["UserID"])
|
bot.matrix_client = AsyncClient(homeserver, user=config["Matrix"]["UserID"])
|
||||||
|
|
Loading…
Reference in a new issue