+def puzzle_channel_description(puzzle):
+ """Compute the channel description for a puzzle"""
+
+ url = puzzle.get('url', None)
+ sheet_url = puzzle.get('sheet_url', None)
+ tags = puzzle.get('tags', [])
+ state = puzzle.get('state', None)
+
+ description = (
+ "Puzzle: \"{}\".\n".format(puzzle['name'])
+ )
+
+ links = ''
+ if url:
+ links += " <{}|Original puzzle> ".format(url)
+
+ if sheet_url:
+ links += " <{}|Sheet>".format(sheet_url)
+
+ if links:
+ description += "Links:{}\n".format(links)
+
+ if tags:
+ description += "Tags: {}\n".format(
+ " ".join(["`{}`".format(t) for t in tags]))
+
+ if state:
+ description += "State: {}\n".format(state)
+
+ return description
+