From 4702afe2a85a857bd121d8a5697db3a07c16a491 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 13:41:00 +1100 Subject: [PATCH] Fixed JSON path again --- priceybot2/chatbot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/priceybot2/chatbot.py b/priceybot2/chatbot.py index 1a46e41..4e59e5e 100644 --- a/priceybot2/chatbot.py +++ b/priceybot2/chatbot.py @@ -104,8 +104,9 @@ def format_response(event): text = 'Thanks for adding me to a DM, {}!'.format(sender_name) elif event_type == 'MESSAGE': - if event['space'].get('slashCommand'): - text = f"You used a slash command with ID {event['space']['slashCommand']['commandId']}" + slash_command = event['message']['space'].get('slashCommand') + if slash_command: + text = f"You used a slash command with ID {slash_command['commandId']}" else: text = 'Your message, {}: "{}"'.format(sender_name, event['message']['text'])