From d5c94cdbc648b0fd3173ef07db08a7f35d8a42a2 Mon Sep 17 00:00:00 2001 From: ctmbl Date: Thu, 19 Oct 2023 00:50:21 +0200 Subject: [PATCH] Fix unit tests crashing because of unset but parsed env var --- src/bot/root_pythia_bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bot/root_pythia_bot.py b/src/bot/root_pythia_bot.py index 84104e7..6f80794 100644 --- a/src/bot/root_pythia_bot.py +++ b/src/bot/root_pythia_bot.py @@ -13,7 +13,11 @@ from bot.dummy_db_manager import DummyDBManager -CHANNEL_ID = int(getenv("CHANNEL_ID")) +CHANNEL_ID = getenv('CHANNEL_ID') +if CHANNEL_ID.isnumeric(): + CHANNEL_ID = int(CHANNEL_ID) +else: + logging.warning("CHANNEL_ID environment variable is either not set or not an integer: %s", CHANNEL_ID) def craft_intents():