From 04b4f0ec01cae08aca46694eac931a58f227478e Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 13:32:33 +1100 Subject: [PATCH 1/7] Added test slash command --- priceybot2/chatbot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/priceybot2/chatbot.py b/priceybot2/chatbot.py index 4a115a1..b2a2fc7 100644 --- a/priceybot2/chatbot.py +++ b/priceybot2/chatbot.py @@ -104,7 +104,10 @@ def format_response(event): text = 'Thanks for adding me to a DM, {}!'.format(sender_name) elif event_type == 'MESSAGE': - text = 'Your message, {}: "{}"'.format(sender_name, event['message']['text']) + if event['slashCommand']: + text = f"You used a slash command with ID {event['slashCommand']['commandId']}" + else: + text = 'Your message, {}: "{}"'.format(sender_name, event['message']['text']) response = {'text': text} From 310c9ed759743d8a9b0809edd45bc38555c8f28a Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 13:35:52 +1100 Subject: [PATCH 2/7] Changed JSON path --- priceybot2/chatbot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/priceybot2/chatbot.py b/priceybot2/chatbot.py index b2a2fc7..1a46e41 100644 --- a/priceybot2/chatbot.py +++ b/priceybot2/chatbot.py @@ -104,8 +104,8 @@ def format_response(event): text = 'Thanks for adding me to a DM, {}!'.format(sender_name) elif event_type == 'MESSAGE': - if event['slashCommand']: - text = f"You used a slash command with ID {event['slashCommand']['commandId']}" + if event['space'].get('slashCommand'): + text = f"You used a slash command with ID {event['space']['slashCommand']['commandId']}" else: text = 'Your message, {}: "{}"'.format(sender_name, event['message']['text']) From 4702afe2a85a857bd121d8a5697db3a07c16a491 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 13:41:00 +1100 Subject: [PATCH 3/7] 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']) From 63409e672501d03e53871be659a726bb1d64ba3b Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 13:41:56 +1100 Subject: [PATCH 4/7] x --- priceybot2/chatbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priceybot2/chatbot.py b/priceybot2/chatbot.py index 4e59e5e..e2ca296 100644 --- a/priceybot2/chatbot.py +++ b/priceybot2/chatbot.py @@ -104,7 +104,7 @@ def format_response(event): text = 'Thanks for adding me to a DM, {}!'.format(sender_name) elif event_type == 'MESSAGE': - slash_command = event['message']['space'].get('slashCommand') + slash_command = event['messages']['space'].get('slashCommand') if slash_command: text = f"You used a slash command with ID {slash_command['commandId']}" else: From 30fc36a4617d594377bffaf363cf2ccb37dad5c5 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 13:43:12 +1100 Subject: [PATCH 5/7] Should work now --- priceybot2/chatbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priceybot2/chatbot.py b/priceybot2/chatbot.py index e2ca296..2372b4a 100644 --- a/priceybot2/chatbot.py +++ b/priceybot2/chatbot.py @@ -104,7 +104,7 @@ def format_response(event): text = 'Thanks for adding me to a DM, {}!'.format(sender_name) elif event_type == 'MESSAGE': - slash_command = event['messages']['space'].get('slashCommand') + slash_command = event['message'].get('slashCommand') if slash_command: text = f"You used a slash command with ID {slash_command['commandId']}" else: From 5f4b56864137346f24daa69b46b74a0ba8643655 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 15:02:15 +1100 Subject: [PATCH 6/7] Updated deployment script and changed the index template --- .cpanel.yml | 3 ++- priceybot2/templates/index.html | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.cpanel.yml b/.cpanel.yml index c18b019..2f8d860 100644 --- a/.cpanel.yml +++ b/.cpanel.yml @@ -2,4 +2,5 @@ deployment: tasks: - export DEPLOYPATH=/home/benjamyntesting/chatbot/ - - cp -Rfv * $DEPLOYPATH \ No newline at end of file + - cp -Rfv * $DEPLOYPATH + - touch $DEPLOYPATH/tmp/restart.txt \ No newline at end of file diff --git a/priceybot2/templates/index.html b/priceybot2/templates/index.html index ce45b56..a490dcf 100644 --- a/priceybot2/templates/index.html +++ b/priceybot2/templates/index.html @@ -2,9 +2,9 @@ {% block content %}

- Flask Login Example + Welcome to the future

- Easy authentication and authorization in Flask. + PriceyBot2.0 ready and listening

{% endblock %} \ No newline at end of file From 076c9bdd4c3ada67f868a756983666d2e6910bbb Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 9 Mar 2023 15:13:08 +1100 Subject: [PATCH 7/7] Test --- priceybot2/templates/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/priceybot2/templates/index.html b/priceybot2/templates/index.html index a490dcf..e2e69fa 100644 --- a/priceybot2/templates/index.html +++ b/priceybot2/templates/index.html @@ -2,9 +2,9 @@ {% block content %}

- Welcome to the future + Welcome to the future.

- PriceyBot2.0 ready and listening + PriceyBot2.0 ready and listening.

{% endblock %} \ No newline at end of file