From e23edacac246ac96418cdfe97469402341fe2ec0 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 21 Oct 2020 11:57:45 -0700 Subject: [PATCH] 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. --- turbot_lambda/turbot_lambda.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.45.2