From 6e05a2a3f9be1f0f6ef59f8d2acc43cd871d4e6b Mon Sep 17 00:00:00 2001 From: Alex Kelly Date: Tue, 29 Nov 2022 22:09:11 -0500 Subject: [PATCH] merge upstream formatter for grafana_9x --- matrix_webhook/formatters/grafana_9x.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 matrix_webhook/formatters/grafana_9x.py diff --git a/matrix_webhook/formatters/grafana_9x.py b/matrix_webhook/formatters/grafana_9x.py new file mode 100644 index 0000000..41fe370 --- /dev/null +++ b/matrix_webhook/formatters/grafana_9x.py @@ -0,0 +1,9 @@ +def grafana_9x(data, headers): + """Pretty-print a Grafana newer than v9.x notification.""" + text = "" + if "title" in data: + text = "#### " + data["title"] + "\n" + if "message" in data: + text = text + data["message"].replace("\n", "\n\n") + "\n\n" + data["body"] = text + return data