]> git.cworth.org Git - turbot/commitdiff
Add both round and "-m" (for META), if appropriate, into channel name
authorCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2021 15:52:41 +0000 (07:52 -0800)
committerCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2021 16:01:02 +0000 (08:01 -0800)
For better grouping of related puzzles in the channel list

turbot/puzzle.py

index f2816acb5b42b5903c3587060bc03680e706d670..e1e1bc2c6ed683fa8fe92962e4c476d59c433acf 100644 (file)
@@ -242,11 +242,21 @@ def puzzle_channel_topic(puzzle):
 def puzzle_channel_name(puzzle):
     """Compute the channel name for a puzzle"""
 
+    round = ''
+    if 'rounds' in puzzle:
+        round = '-' + puzzle_id_from_name(puzzle['rounds'][0])
+
+    meta = ''
+    if puzzle['type'] == 'meta':
+        meta = '-m'
+
     # Note: We don't use puzzle['puzzle_id'] here because we're keeping
     # that as a persistent identifier in the database. Instead we
     # create a new ID-like identifier from the current name.
-    channel_name = "{}-{}".format(
+    channel_name = "{}{}{}-{}".format(
         puzzle['hunt_id'],
+        round,
+        meta,
         puzzle_id_from_name(puzzle['name'])
     )