url = puzzle.get('url', None)
sheet_url = puzzle.get('sheet_url', None)
state = puzzle.get('state', None)
+ tags = puzzle.get('tags', [])
status_emoji = ''
solution_str = ''
state_str = ''
if state:
- state_str = "\n{}".format(state)
+ state_str = " State: {}".format(state)
+
+ tags_str = ''
+ if tags:
+ tags_str = " Tags: "+" ".join(["`{}`".format(tag) for tag in tags])
+
+ extra_str = ''
+ if state_str or tags_str:
+ extra_str = "\n{}{}".format(tags_str, state_str)
rounds_str = ''
if include_rounds and 'rounds' in puzzle:
", ".join(rounds)
)
- puzzle_text = "{}{} {}<{}|{}> ({}){}{}".format(
- status_emoji, solution_str,
+ puzzle_text = "{} {}<{}|{}> {} ({}){}{}".format(
+ status_emoji,
meta_str,
channel_url(channel_id), name,
+ solution_str,
', '.join(links), rounds_str,
- state_str
+ extra_str
)
# Combining hunt ID and puzzle ID together here is safe because
if len(links):
topic += "({})".format(', '.join(links))
+ tags = puzzle.get('tags', [])
+ if tags:
+ topic += " {}".format(" ".join(["`{}`".format(t) for t in tags]))
+
state = puzzle.get('state', None)
if state:
topic += " {}".format(state)
channel=channel_id,
name=channel_name
)
+
+# A copy deep enough to work for puzzle_update_channel_and_sheet above
+def puzzle_copy(old_puzzle):
+ new_puzzle = old_puzzle.copy()
+
+ if 'tags' in old_puzzle:
+ new_puzzle['tags'] = old_puzzle['tags'].copy()
+
+ return new_puzzle