X-Git-Url: https://git.cworth.org/git?p=turbot;a=blobdiff_plain;f=turbot%2Fpuzzle.py;h=e3a4f741580f711d0c36df9f459a265fd364b266;hp=b86a529ed47b9d5c64e6d4660104bcbfeb58a0e9;hb=1efdf784442e0bfc0fb96a18ec833e2801af7973;hpb=30846beeed5db3c857a19f75a91dc33c014c9204 diff --git a/turbot/puzzle.py b/turbot/puzzle.py index b86a529..e3a4f74 100644 --- a/turbot/puzzle.py +++ b/turbot/puzzle.py @@ -62,6 +62,7 @@ def puzzle_blocks(puzzle, include_rounds=False): 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 = '' @@ -85,7 +86,15 @@ def puzzle_blocks(puzzle, include_rounds=False): 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: @@ -101,7 +110,7 @@ def puzzle_blocks(puzzle, include_rounds=False): 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 @@ -209,6 +218,10 @@ def puzzle_channel_topic(puzzle): 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)