]> git.cworth.org Git - turbot/blobdiff - turbot/interaction.py
Extend puzzle search to include type and tags
[turbot] / turbot / interaction.py
index fb11599034fc1f518a1ec7a19a7d54ade43862be..1f5d11f4b4218b9a92680088d87521d69c6cd74b 100644 (file)
@@ -13,7 +13,8 @@ from turbot.puzzle import (
     puzzle_update_channel_and_sheet,
     puzzle_id_from_name,
     puzzle_blocks,
-    puzzle_sort_key
+    puzzle_sort_key,
+    puzzle_copy
 )
 from turbot.round import round_quoted_puzzles_titles_answers
 import turbot.rot
@@ -881,8 +882,8 @@ def state(turb, body, args):
         return bot_reply(
             "Sorry, the /state command only works in a puzzle channel")
 
-    # Make a copy of the puzzle object
-    puzzle = old_puzzle.copy()
+    # Make a deep copy of the puzzle object
+    puzzle = puzzle_copy(old_puzzle)
 
     # Update the puzzle in the database
     puzzle['state'] = args
@@ -941,8 +942,8 @@ def tag(turb, body, args):
 
     # OK. Error checking is done. Let's get to work
 
-    # Make a copy of the puzzle object
-    puzzle = old_puzzle.copy()
+    # Make a deep copy of the puzzle object
+    puzzle = puzzle_copy(old_puzzle)
 
     if action == 'remove':
         puzzle['tags'] = [t for t in puzzle['tags'] if t != tag]
@@ -977,8 +978,8 @@ def solved(turb, body, args):
         return bot_reply(
             "Error, no solution provided. Usage: `/solved SOLUTION HERE`")
 
-    # Make a copy of the puzzle object
-    puzzle = old_puzzle.copy()
+    # Make a deep copy of the puzzle object
+    puzzle = puzzle_copy(old_puzzle)
 
     # Set the status and solution fields in the database
     puzzle['status'] = 'solved'
@@ -1023,9 +1024,10 @@ def hunt(turb, body, args):
     character in a term). All terms must match on a puzzle in order
     for that puzzle to be included. But a puzzle will be considered to
     match if any of the puzzle title, round title, puzzle URL, puzzle
-    state, or puzzle solution match. Matching will be performed
-    without regard to case sensitivity and the search terms can
-    include regular expression syntax.
+    state, puzzle type, tags, or puzzle solution match. Matching will
+    be performed without regard to case sensitivity and the search
+    terms can include regular expression syntax.
+
     """
 
     channel_id = body['channel_id'][0]