]> git.cworth.org Git - turbot/commitdiff
Mention the newly-created sheet in the newly-created Slack channel
authorCarl Worth <cworth@cworth.org>
Tue, 20 Oct 2020 01:40:33 +0000 (18:40 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 20 Oct 2020 01:40:33 +0000 (18:40 -0700)
There's no point in having a sheet if nobody ever sees it.

turbot/actions.py

index 860ea462f1d3b8040e736e6151da820088a8032b..4b24f85d8f5da260995b3bc7b6ee4f00c251fd60 100644 (file)
@@ -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,
     }