]> git.cworth.org Git - turbot/commitdiff
Make text optional for slash commands
authorCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2020 18:57:45 +0000 (11:57 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 21 Oct 2020 18:57:45 +0000 (11:57 -0700)
We're planning a new approach which is to make it so that a slash
command with no argument string pops up a modal dialog. For this to
work, we have to allow for a body that includes no 'text' key.

turbot_lambda/turbot_lambda.py

index 2ba91842de0cd622a382625695ec5c8be4e6a528..59312c8b2e1e19e7b573b7e108cc2458384cb286 100644 (file)
@@ -211,7 +211,10 @@ def turbot_slash_command(turb, body):
     """
 
     command = body['command'][0]
-    args = body['text'][0]
+    if 'text' in body:
+        args = body['text'][0]
+    else:
+        args = ''
 
     if command in turbot.commands.commands:
         return turbot.commands.commands[command](turb, body, args)