Skip to content

Commit

Permalink
Merge pull request #176 from locriandev/monitoring-channel-resilience
Browse files Browse the repository at this point in the history
When an invalid monitoring channel is provided, do not crash
  • Loading branch information
locriandev authored Mar 18, 2024
2 parents b94c5ca + 3e2f0a7 commit ad7f2c0
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("username", bot_config["self"]["name"])

Expand Down

0 comments on commit ad7f2c0

Please sign in to comment.