From: Carl Worth Date: Tue, 20 Oct 2020 01:40:33 +0000 (-0700) Subject: Mention the newly-created sheet in the newly-created Slack channel X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=75f4acf948be51d904c59b4afc600fb4e5dc237b;p=turbot Mention the newly-created sheet in the newly-created Slack channel There's no point in having a sheet if nobody ever sees it. --- 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, }