From da691ed8a14898bbc042a647afc81e2bc65123d4 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 19 Apr 2023 17:18:40 +0200 Subject: [PATCH] dont translate from en to en --- matrix_pygmalion_bot/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/matrix_pygmalion_bot/core.py b/matrix_pygmalion_bot/core.py index d8a5604..24821d0 100644 --- a/matrix_pygmalion_bot/core.py +++ b/matrix_pygmalion_bot/core.py @@ -257,11 +257,12 @@ class Callbacks(object): answer = await self.bot.text_ai.generate_sync(full_prompt, self.bot.runpod_api_key, self.bot, typing) answer = answer.strip() await self.client.room_typing(room.room_id, False) - if not (self.bot.translate is None): + if (self.bot.translate is None) or (self.bot.translate == "en"): + await self.bot.send_message(self.client, room.room_id, answer, reply_to=chat_message.event_id) + else: translated_answer = translate.translate(answer, "en", self.bot.translate) await self.bot.send_message(self.client, room.room_id, translated_answer, reply_to=chat_message.event_id, original_message=answer) - else: - await self.bot.send_message(self.client, room.room_id, answer, reply_to=chat_message.event_id) + if not "message_count" in self.bot.room_config[room.room_id]: self.bot.room_config[room.room_id]["message_count"] = 0 self.bot.room_config[room.room_id]["message_count"] += 1