From d29699ecca69f7d203179a18569722d05798cf58 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 16 Oct 2020 17:28:01 -0700 Subject: [PATCH] Gracefully handle placeholder text for hunt channel ID Letting the user know that a Slack channel is still being created if the channel ID is a placeholder value. --- turbot/events.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/turbot/events.py b/turbot/events.py index dfe4cb9..78fc560 100644 --- a/turbot/events.py +++ b/turbot/events.py @@ -1,7 +1,16 @@ from turbot.blocks import section_block, text_block, button_block, actions_block def hunt_block(hunt): - text = "{}: <#{}>".format(hunt['name'], hunt['channel_id']) + name = hunt['name'] + channel_id = hunt['channel_id'] + + text = "{}: ".format(name) + + if (channel_id.startswith("placeholder-")): + text += "[Slack channel is still being created. Please wait.]" + else: + text += "<#{}>".format(channel_id) + return section_block(text_block(text)) def home(turb, user_id, body): -- 2.43.0