Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +20 -16
chatbot/plugins/chat.py
CHANGED
@@ -741,6 +741,7 @@ async def terjemahkan(client, callback):
|
|
741 |
await callback.answer("Sorry your account is disabled", True)
|
742 |
return
|
743 |
|
|
|
744 |
try:
|
745 |
if user_id == 0:
|
746 |
return await callback.answer("Server busy try again later", True)
|
@@ -751,22 +752,25 @@ async def terjemahkan(client, callback):
|
|
751 |
return await callback.answer("translate history not found")
|
752 |
|
753 |
for translations in data_tr["translate_history"]:
|
754 |
-
if translations.get("uuid") == uuidstr:
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
|
|
|
|
|
|
770 |
await callback.answer("Translate Updated Now", False)
|
771 |
except Exception as e:
|
772 |
LOGS.error(f"Exception translate: {str(e)}")
|
|
|
741 |
await callback.answer("Sorry your account is disabled", True)
|
742 |
return
|
743 |
|
744 |
+
translate_result = ""
|
745 |
try:
|
746 |
if user_id == 0:
|
747 |
return await callback.answer("Server busy try again later", True)
|
|
|
752 |
return await callback.answer("translate history not found")
|
753 |
|
754 |
for translations in data_tr["translate_history"]:
|
755 |
+
if str(translations.get("uuid")) == str(uuidstr):
|
756 |
+
translate_result += translations.get("text", "no translation")
|
757 |
+
break
|
758 |
+
|
759 |
+
translation = trans(
|
760 |
+
translate_result,
|
761 |
+
sourcelang="auto",
|
762 |
+
targetlang=str(targetlang)
|
763 |
+
)
|
764 |
+
keyboard = create_keyboard(
|
765 |
+
user_id=user_id,
|
766 |
+
uuid_str=str(uuidstr),
|
767 |
+
chat=data_tr.get("channel_username", "RendyProjects"),
|
768 |
+
is_menu=data_tr.get("is_channel_photo", False)
|
769 |
+
)
|
770 |
+
await callback.edit_message_text(
|
771 |
+
translation.text,
|
772 |
+
reply_markup=keyboard
|
773 |
+
)
|
774 |
await callback.answer("Translate Updated Now", False)
|
775 |
except Exception as e:
|
776 |
LOGS.error(f"Exception translate: {str(e)}")
|