Fix bug in filtering replies

This commit is contained in:
deadcade 2022-08-27 16:32:11 +02:00
parent c239dcf489
commit 3beb10075f
1 changed files with 1 additions and 1 deletions

View File

@ -369,7 +369,7 @@ async def reaction_callback(room: nio.MatrixRoom, event: nio.UnknownEvent, react
original_body = reacted_to_event.body
# If the message was a reply
if reacted_to_event.source.get("content", {}).get("m.relates_to", {}).get("m.in_reply_to", {}).get("event_id"):
original_body = "\n\n".join(reacted_to_event.split("\n\n")[1:]) # Remove the in reply to part
original_body = "\n\n".join(reacted_to_event.body.split("\n\n")[1:]) # Remove the in reply to part
translated = lt.translate(original_body, from_lang, "en")
lang = lt.detect(reacted_to_event.body)[0]["language"].upper() if from_lang == "auto" else from_lang.upper()
return await send_reply(room.room_id, reacted_to_event, "Translated from " + lang + " (" + flag_emoji("US" if lang == "EN" else lang) + "):\n" + translated + "\n")