From f21d6b8da723db6a6b252cf6e8ac4ac6cfce0d56 Mon Sep 17 00:00:00 2001 From: git-bruh Date: Mon, 30 Nov 2020 20:44:17 +0530 Subject: [PATCH] Add fallback stuff for replies --- main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.py b/main.py index 313929f..cc26aa0 100644 --- a/main.py +++ b/main.py @@ -78,10 +78,24 @@ class MatrixClient(object): } if reply_id: + reply_event = await matrix_client.room_get_event( + config["room_id"], reply_id + ) + + reply_event = reply_event.event.source["content"]["body"] + content["m.relates_to"] = { "m.in_reply_to": {"event_id": reply_id}, } + content["format"] = "org.matrix.custom.html" + + content["formatted_body"] = (f"""
+In reply to +{config["username"]}
+{reply_event}
{message} +""") + if edit_id: content["body"] = f" * {message}"