From: Carl Worth Date: Wed, 21 Oct 2020 18:57:45 +0000 (-0700) Subject: Make text optional for slash commands X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=e23edacac246ac96418cdfe97469402341fe2ec0;p=turbot Make text optional for slash commands 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. --- diff --git a/turbot_lambda/turbot_lambda.py b/turbot_lambda/turbot_lambda.py index 2ba9184..59312c8 100644 --- a/turbot_lambda/turbot_lambda.py +++ b/turbot_lambda/turbot_lambda.py @@ -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)