]> git.cworth.org Git - turbot/blobdiff - turbot/interaction.py
Live fix for apparently overflowing the Slack message limit with hunt details
[turbot] / turbot / interaction.py
index 507da76741730f2944962b10306a1de42c2696d6..94787b40fbc28e15c7773f0ca497b5dcf4bea1b9 100644 (file)
@@ -928,13 +928,20 @@ def new_puzzle(turb, body):
         return bot_reply("Sorry, this channel doesn't appear to "
                          + "be a hunt or puzzle channel")
 
+    # We used puzzle (if available) to select the initial round(s)
+    puzzle = puzzle_for_channel(turb, channel_id)
+    initial_rounds = None
+    if puzzle:
+        initial_rounds=puzzle.get("rounds", None)
+
     round_options = hunt_rounds(turb, hunt['hunt_id'])
 
     if len(round_options):
         round_options_block = [
             multi_select_block("Round(s)", "rounds",
                                "Existing round(s) this puzzle belongs to",
-                               round_options)
+                               round_options,
+                               initial_options=initial_rounds)
         ]
     else:
         round_options_block = []
@@ -1262,10 +1269,11 @@ def hunt(turb, body, args):
 
     blocks = hunt_blocks(turb, hunt, puzzle_status=status, search_terms=terms)
 
-    requests.post(response_url,
-                  json = { 'blocks': blocks },
-                  headers = {'Content-type': 'application/json'}
-                  )
+    for block in blocks:
+        requests.post(response_url,
+                      json = { 'blocks': block },
+                      headers = {'Content-type': 'application/json'}
+                      )
 
     return lambda_ok
 
@@ -1336,10 +1344,11 @@ def round(turb, body, args):
                          limit_to_rounds=puzzle.get('rounds', [])
                          )
 
-    requests.post(response_url,
-                  json = { 'blocks': blocks },
-                  headers = {'Content-type': 'application/json'}
-                  )
+    for block in blocks:
+        requests.post(response_url,
+                      json = { 'blocks': block },
+                      headers = {'Content-type': 'application/json'}
+                      )
 
     return lambda_ok