]> git.cworth.org Git - turbot/blobdiff - turbot/puzzle.py
Add an initial implementation of /help
[turbot] / turbot / puzzle.py
index 1dbea5d74906c447b3e6b09df70758f4379389d5..08e86218738bbfba6cdeff598ded4acdfb758cec 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.get('type', 'plain') == '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'])
     )
 
@@ -290,7 +300,7 @@ def puzzle_update_channel_and_sheet(turb, puzzle, old_puzzle=None):
         old_sheet_name = puzzle_sheet_name(old_puzzle)
 
     if sheet_name != old_sheet_name:
-        turbot.sheets.renameSheet(turb, puzzle['sheet_url'], sheet_name)
+        turbot.sheets.rename_spreadsheet(turb, puzzle['sheet_url'], sheet_name)
 
     # Compute the Slack channel name and set it if it has changed
     channel_name = puzzle_channel_name(puzzle)