From 0c8e286f2fcfd23444ecfa765c86040b01e74746 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 2 Jan 2021 09:24:53 -0800 Subject: [PATCH] Prevent failure of /solved command if /state had never been run The recent code to make /solved clear the /state field was buggy in that it would result in a dispatch_failed error in Slack if /state had never been invoked previously. --- turbot/interaction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/turbot/interaction.py b/turbot/interaction.py index e6aadb6..3598234 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -576,7 +576,8 @@ def solved(turb, body, args): # Set the status and solution fields in the database puzzle['status'] = 'solved' puzzle['solution'].append(args) - del puzzle['state'] + if 'state' in puzzle: + del puzzle['state'] turb.table.put_item(Item=puzzle) # Report the solution to the puzzle's channel -- 2.43.0