Fixed JSON path again

This commit is contained in:
Benjamyn Love 2023-03-09 13:41:00 +11:00
parent 310c9ed759
commit 4702afe2a8

View File

@ -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'])