From 3e2f0a705ffaab01a1ed66d6a979681402050934 Mon Sep 17 00:00:00 2001 From: "D. Paolella" Date: Fri, 15 Mar 2024 15:46:32 +0100 Subject: [PATCH] When an invalid monitoring channel is provided, do not crash --- art-bot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/art-bot.py b/art-bot.py index ff28752..4504d2f 100644 --- a/art-bot.py +++ b/art-bot.py @@ -66,9 +66,10 @@ def handle_message(client, event): logger.warning("Warning: no monitoring_channel configured.") else: found = lookup_channel(web_client, bot_config["monitoring_channel"], only_private=True) - if not found: - raise Exception(f"Invalid monitoring channel configured: {bot_config['monitoring_channel']}") - bot_config["monitoring_channel_id"] = found["id"] + if found: + bot_config["monitoring_channel_id"] = found["id"] + else: + logger.warning("Invalid monitoring channel configured: %s", bot_config['monitoring_channel']) bot_config.setdefault("friendly_channels", []) bot_config["friendly_channel_ids"] = []