search_terms: A list of search terms. Only puzzles that match
all of these terms will be included in the
result. A match will be considered on any of
- puzzle title, round title, puzzle URL, or solution
- string. Terms can include regular expression
- syntax.
+ puzzle title, round title, puzzle URL, puzzle
+ state or solution string. Terms can include
+ regular expression syntax.
The return value can be used in a Slack command expecting blocks to
provide all the details of a hunt, (puzzles, their state,
characters, (though quotation marks can be used to include a space
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, or
- puzzle solution match. Matching will be performed without regard
- to case sensitivity and the search terms can include regular
- expression syntax.
+ 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.
"""
channel_id = body['channel_id'][0]
"""Returns True if this puzzle matches the given string (regexp)
A match will be considered on any of puzzle title, round title,
- puzzle URL, or solution string. The string can include regular
- expression syntax. Matching is case insensitive.
+ puzzle URL, puzzle state, or solution string. The string can
+ include regular expression syntax. Matching is case insensitive.
"""
p = re.compile('.*'+pattern+'.*', re.IGNORECASE)
if p.match(round):
return True
- if p.match(puzzle['url']):
- return True
+ if 'url' in puzzle:
+ if p.match(puzzle['url']):
+ return True
- for solution in puzzle['solution']:
- if p.match(solution):
+ if 'state' in puzzle:
+ if p.match(puzzle['state']):
return True
+ if 'solution' in puzzle:
+ for solution in puzzle['solution']:
+ if p.match(solution):
+ return True
+
return False
def puzzle_matches_all(puzzle, patterns):
"""Returns True if this puzzle matches all of the given list of patterns
A match will be considered on any of puzzle title, round title,
- puzzle URL, or solution string. All patterns must match the puzzle
- somewhere, (that is, there is an implicit logical AND between
- patterns). Patterns can include regular expression
+ puzzle URL, puzzle state, or solution string. All patterns must
+ match the puzzle somewhere, (that is, there is an implicit logical
+ AND between patterns). Patterns can include regular expression
syntax. Matching is case insensitive.
"""