From f2d1e77569336da5cae322ced59a002555a42d5d Mon Sep 17 00:00:00 2001 From: justin melvin Date: Fri, 27 Nov 2020 22:49:59 -0800 Subject: [PATCH] Append "-solved" to puzzle channel names when /solved --- turbot/interaction.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/turbot/interaction.py b/turbot/interaction.py index a3bfea0..1c5b34e 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -352,6 +352,7 @@ def puzzle_submission(turb, payload, metadata): table.put_item( Item={ "channel_id": puzzle_channel_id, + "orig_channel_name": hunt_dash_channel, "solution": [], "status": 'unsolved', "name": name, @@ -362,6 +363,13 @@ def puzzle_submission(turb, payload, metadata): return lambda_ok +def rename_channel_to_solved(turb, puzzle): + orig_channel_name = puzzle['orig_channel_name'] + channel_id = puzzle['channel_id'] + newName = orig_channel_name + '-solved' + turb.slack_client.conversations_rename(channel=channel_id, + name=newName) + # XXX: This duplicates functionality eith events.py:set_channel_description def set_channel_topic(turb, puzzle): channel_id = puzzle['channel_id'] @@ -447,6 +455,9 @@ def solved(turb, body, args): # And rename the sheet to prefix with SOLVED - turbot.sheets.renameSheet(turb, puzzle['sheet_url'], 'SOLVED - ' + puzzle['name']) + # Finally, rename the Slack channel to add the suffix '-solved' + rename_channel_to_solved(turb, puzzle) + return lambda_ok commands["/solved"] = solved -- 2.43.0