]> git.cworth.org Git - turbot/commitdiff
Restrict list of blocks to 100 items
authorCarl Worth <cworth@cworth.org>
Sat, 16 Jan 2021 16:03:10 +0000 (08:03 -0800)
committerCarl Worth <cworth@cworth.org>
Sat, 16 Jan 2021 16:03:10 +0000 (08:03 -0800)
Since I've now seen Slack complaining if lists are greater than 100 items.

turbot/interaction.py

index 94787b40fbc28e15c7773f0ca497b5dcf4bea1b9..580aad52b15e2b03e002fb835917c615d86c2ec8 100644 (file)
@@ -1270,6 +1270,8 @@ def hunt(turb, body, args):
     blocks = hunt_blocks(turb, hunt, puzzle_status=status, search_terms=terms)
 
     for block in blocks:
+        if len(block) > 100:
+            block = block[:100]
         requests.post(response_url,
                       json = { 'blocks': block },
                       headers = {'Content-type': 'application/json'}
@@ -1345,6 +1347,8 @@ def round(turb, body, args):
                          )
 
     for block in blocks:
+        if len(block) > 100:
+            block = block[:100]
         requests.post(response_url,
                       json = { 'blocks': block },
                       headers = {'Content-type': 'application/json'}