From 8e07c5412478169a558a9fda372f2b18eb1be3de Mon Sep 17 00:00:00 2001 From: Someone Date: Sat, 12 Feb 2022 00:56:45 +0100 Subject: [PATCH] core/MMBot.py --- core/MMBot.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/core/MMBot.py b/core/MMBot.py index 795a868..7a9454c 100644 --- a/core/MMBot.py +++ b/core/MMBot.py @@ -319,9 +319,12 @@ class MMBot(): if props: data.update({"props": props}) + else: + props={} if att: - data.update({"attachments": att}) + props.update({"attachments": att}) + data.update({"props": props}) self.respond(http_code, data) @@ -332,16 +335,19 @@ class MMBot(): if props: data.update({"props": props}) + else: + props={} if att: - data.update({"attachments": att}) + props.update({"attachments": att}) + data.update({"props": props}) self.respond(http_code, data) - def respond_interactive_temp(self, message, http_code=200): + def respond_interactive_temp(self, message): # cant be secondary, because no response url (interactive messages only?) - self.respond(http_code, {"ephemeral_text":message}) + self.respond(200, {"skip_slack_parsing":True, "ephemeral_text": message}) # Use to send a failure to the user. Use only the first time during a request. Should retain input on clientside. @@ -356,6 +362,11 @@ class MMBot(): self.respond(000, data) + def respond_interactive_err(self, message): + # cant be secondary, because no response url (interactive messages only?) + self.respond(200, {"skip_slack_parsing":True, "ephemeral_text":"## :x: Failure! :(\n#### "+message}) + + def respond(self, http_code=200, data=None, if_nonzero_secondary='exc'): """ First response call must have a valid http code. @@ -364,6 +375,9 @@ class MMBot(): use if_nonzero_secondary = 'force' to send secondary with http_code != 0. """ + import pprint + pprint.pprint(data) + if data is None: data = {} -- 2.43.0