X-Git-Url: https://git.cworth.org/git?p=turbot;a=blobdiff_plain;f=turbot%2Finteraction.py;h=bfb759ada53f9395ac0f8c629ec0fd0991a4b55f;hp=e68aa6f276a7754e60d38a1c73cafbbc70825ec2;hb=2e5bec87f32fb9cba294cbc7c63bb155e3825ebe;hpb=9a32366dc4ed1c9ea6e310ad23923b564691a8fa diff --git a/turbot/interaction.py b/turbot/interaction.py index e68aa6f..bfb759a 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -247,6 +247,19 @@ def edit_puzzle_submission(turb, payload, metadata): turb.slack_client, puzzle['channel_id'], edit_message, blocks=blocks) + # Also inform the hunt if the puzzle's solved status changed + if puzzle['status'] != old_puzzle['status']: + hunt = find_hunt_for_hunt_id(turb, puzzle['hunt_id']) + if puzzle['status'] == 'solved': + message = "Puzzle <{}|{}> has been solved!".format( + puzzle['channel_url'], + puzzle['name']) + else: + message = "Oops. Puzzle <{}|{}> has been marked unsolved!".format( + puzzle['channel_url'], + puzzle['name']) + slack_send_message(turb.slack_client, hunt['channel_id'], message) + # We need to set the channel topic if any of puzzle name, url, # state, status, or solution, has changed. Let's just do that # unconditionally here.