]> git.cworth.org Git - turbot/blobdiff - turbot/hunt.py
Add a pencil-shaped "edit hunt" button when displaying a hunt
[turbot] / turbot / hunt.py
index c2e59e2be937c4577e7696f80b01fce51356e05d..97712982fd32aa7afb4367a7b65ce0838f3c910f 100644 (file)
@@ -1,4 +1,6 @@
-from turbot.blocks import section_block, text_block, divider_block
+from turbot.blocks import (
+    section_block, text_block, divider_block, accessory_block, button_block
+)
 from turbot.round import round_blocks
 from turbot.puzzle import puzzle_blocks, puzzle_matches_all
 from turbot.channel import channel_url
@@ -54,8 +56,9 @@ def hunt_blocks(turb, hunt, puzzle_status='unsolved', search_terms=[],
                     all of these terms will be included in the
                     result. A match will be considered on any of
                     puzzle title, round title, puzzle URL, puzzle
-                    state or solution string. Terms can include
-                    regular expression syntax.
+                    state, puzzle type, tags, or solution
+                    string. Terms can include regular expression
+                    syntax.
 
       limit_to_rounds: A list of rounds. If provided only the given
                        rounds will be included in the output. Note:
@@ -109,12 +112,18 @@ def hunt_blocks(turb, hunt, puzzle_status='unsolved', search_terms=[],
         hunt_text += " matching {}".format(" AND ".join(quoted_terms))
 
     blocks = [
-        section_block(text_block(hunt_text)),
+        accessory_block(
+            section_block(text_block(hunt_text)),
+            button_block("✏", "edit_hunt", hunt_id)
+        )
     ]
 
     if not len(puzzles):
+        text = "No puzzles found."
+        if puzzle_status != 'all':
+            text += ' (Consider searching for "all" puzzles?)'
         blocks += [
-            section_block(text_block("No puzzles found."))
+            section_block(text_block(text))
         ]
 
     # Construct blocks for each round