From 75f4acf948be51d904c59b4afc600fb4e5dc237b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Oct 2020 18:40:33 -0700 Subject: [PATCH] Mention the newly-created sheet in the newly-created Slack channel There's no point in having a sheet if nobody ever sees it. --- turbot/actions.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/turbot/actions.py b/turbot/actions.py index 860ea46..4b24f85 100644 --- a/turbot/actions.py +++ b/turbot/actions.py @@ -51,7 +51,7 @@ def new_hunt_submission(turb, payload): channel_id = response['channel']['id'] # Create a sheet for the channel - turbot.sheets.sheets_create(turb, slug) + sheet = turbot.sheets.sheets_create(turb, slug) # Insert the newly-created hunt into the database turb.hunts_table = turb.db.Table("hunts") @@ -61,13 +61,19 @@ def new_hunt_submission(turb, payload): "active": True, "name": name, "slug": slug, - "url": url + "url": url, + "sheet_url": sheet['url'] } ) # Invite the initiating user to the channel turb.slack_client.conversations_invite(channel=channel_id, users=user_id) + # Message the channel with the URL of the sheet + turb.slack_client.chat_postMessage(channel=channel_id, + text="Sheet created for this hunt: {}" + .format(sheet['url'])) + return { 'statusCode': 200, } -- 2.45.2