Fix language indicator showing the wrong language
This commit is contained in:
parent
1713a5180d
commit
6a27b369af
1 changed files with 1 additions and 1 deletions
2
main.py
2
main.py
|
@ -377,7 +377,7 @@ async def reaction_callback(room: nio.MatrixRoom, event: nio.UnknownEvent, react
|
||||||
translated = lt.translate(original_body, from_lang, "en")
|
translated = lt.translate(original_body, from_lang, "en")
|
||||||
except Exception:
|
except Exception:
|
||||||
return await send_text(room.room_id, "Something went wrong translating the message!")
|
return await send_text(room.room_id, "Something went wrong translating the message!")
|
||||||
lang = lt.detect(reacted_to_event.body)[0]["language"].upper() if from_lang == "auto" else from_lang.upper()
|
lang = lt.detect(original_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")
|
return await send_reply(room.room_id, reacted_to_event, "Translated from " + lang + " (" + flag_emoji("US" if lang == "EN" else lang) + "):\n" + translated + "\n")
|
||||||
|
|
||||||
async def message_callback(room: nio.MatrixRoom, event: nio.RoomMessageText) -> None:
|
async def message_callback(room: nio.MatrixRoom, event: nio.RoomMessageText) -> None:
|
||||||
|
|
Loading…
Reference in a new issue