]> git.cworth.org Git - turbot/commitdiff
Add missing return value for /state command
authorCarl Worth <cworth@cworth.org>
Fri, 23 Oct 2020 00:31:20 +0000 (17:31 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 23 Oct 2020 00:31:20 +0000 (17:31 -0700)
So that it can be happy now.

turbot/interaction.py

index 78e209aa10dd61803ac63c57e07ff027deac5449..566a3d83caa287bbe5c6cee94d80058f69a6b808 100644 (file)
@@ -15,6 +15,8 @@ submission_handlers = {}
 # Hunt/Puzzle IDs are restricted to lowercase letters, numbers, and underscores
 valid_id_re = r'^[_a-z0-9]+$'
 
+lambda_ok = {'statusCode': 200}
+
 def bot_reply(message):
     """Construct a return value suitable for a bot reply
 
@@ -70,10 +72,7 @@ def new_hunt(turb, payload):
     if (result['ok']):
         submission_handlers[result['view']['id']] = new_hunt_submission
 
-    return {
-        'statusCode': 200,
-        'body': 'OK'
-    }
+    return lambda_ok
 
 actions['button'] = {"new_hunt": new_hunt}
 
@@ -148,9 +147,7 @@ def new_hunt_submission(turb, payload, metadata):
     # Invite the initiating user to the channel
     turb.slack_client.conversations_invite(channel=channel_id, users=user_id)
 
-    return {
-        'statusCode': 200,
-    }
+    return lambda_ok
 
 def view_submission(turb, payload):
     """Handler for Slack interactive view submission
@@ -198,10 +195,7 @@ def rot(turb, body, args):
     else:
         turb.slack_client.chat_postMessage(channel=channel_id, text=result)
 
-    return {
-        'statusCode': 200,
-        'body': ""
-    }
+    return lambda_ok
 
 commands["/rot"] = rot
 
@@ -319,9 +313,7 @@ def puzzle(turb, body, args):
     if (result['ok']):
         submission_handlers[result['view']['id']] = puzzle_submission
 
-    return {
-        'statusCode': 200
-    }
+    return lambda_ok
 
 commands["/puzzle"] = puzzle
 
@@ -371,9 +363,7 @@ def puzzle_submission(turb, payload, metadata):
         }
     )
 
-    return {
-        'statusCode': 200
-    }
+    return lambda_ok
 
 # XXX: This duplicates functionality eith events.py:set_channel_description
 def set_channel_topic(turb, puzzle):
@@ -418,4 +408,6 @@ def state(turb, body, args):
 
     set_channel_topic(turb, puzzle)
 
+    return lambda_ok
+
 commands["/state"] = state