From: Carl Worth Date: Sat, 2 Jan 2021 17:24:53 +0000 (-0800) Subject: Prevent failure of /solved command if /state had never been run X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;ds=sidebyside;h=0c8e286f2fcfd23444ecfa765c86040b01e74746;p=turbot 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. --- 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