Skip to content

Commit

Permalink
When an invalid monitoring channel is provided, do not crash
Browse files Browse the repository at this point in the history
  • Loading branch information
locriandev committed Mar 15, 2024
1 parent 9d2a03e commit 3e2f0a7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions art-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = []
Expand Down

0 comments on commit 3e2f0a7

Please sign in to comment.