From: Carl Worth Date: Sat, 9 Jan 2021 15:52:41 +0000 (-0800) Subject: Add both round and "-m" (for META), if appropriate, into channel name X-Git-Url: https://git.cworth.org/git?p=turbot;a=commitdiff_plain;h=c09a05591d2224c23dab510a94d4a0fc787aadc8 Add both round and "-m" (for META), if appropriate, into channel name For better grouping of related puzzles in the channel list --- diff --git a/turbot/puzzle.py b/turbot/puzzle.py index f2816ac..e1e1bc2 100644 --- a/turbot/puzzle.py +++ b/turbot/puzzle.py @@ -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']) )