Add fallback stuff for replies
This commit is contained in:
parent
715b987444
commit
f21d6b8da7
1 changed files with 14 additions and 0 deletions
14
main.py
14
main.py
|
@ -78,10 +78,24 @@ class MatrixClient(object):
|
||||||
}
|
}
|
||||||
|
|
||||||
if reply_id:
|
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"] = {
|
content["m.relates_to"] = {
|
||||||
"m.in_reply_to": {"event_id": reply_id},
|
"m.in_reply_to": {"event_id": reply_id},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content["format"] = "org.matrix.custom.html"
|
||||||
|
|
||||||
|
content["formatted_body"] = (f"""<mx-reply><blockquote>
|
||||||
|
<a href="https://matrix.to/#/{config["room_id"]}/{reply_id}">In reply to</a>
|
||||||
|
<a href="https://matrix.to/#/{config["username"]}">{config["username"]}</a><br>
|
||||||
|
{reply_event}</blockquote></mx-reply>{message}
|
||||||
|
""")
|
||||||
|
|
||||||
if edit_id:
|
if edit_id:
|
||||||
content["body"] = f" * {message}"
|
content["body"] = f" * {message}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue