Queer European MD passionate about IT
Bläddra i källkod

Handle multilanguage test in send_message and edit_message_text methods

Davte 4 år sedan
förälder
incheckning
fcb2de71d2
2 ändrade filer med 9 tillägg och 2 borttagningar
  1. 1 1
      davtelepot/__init__.py
  2. 8 1
      davtelepot/bot.py

+ 1 - 1
davtelepot/__init__.py

@@ -14,7 +14,7 @@ __author__ = "Davide Testa"
 __email__ = "davide@davte.it"
 __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
 __license__ = "GNU General Public License v3.0"
-__version__ = "2.4.17"
+__version__ = "2.4.18"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 

+ 8 - 1
davtelepot/bot.py

@@ -1143,7 +1143,7 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
         if not text:
             return
         parse_mode = str(parse_mode)
-        if isinstance(text, dict) and chat_id > 0:
+        if isinstance(text, dict):
             if user_record is None:
                 user_record = self.db['users'].find_one(telegram_id=chat_id)
             text = self.get_message(
@@ -1202,6 +1202,13 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
                 message_id = message_identifier['message_id']
             if 'inline_message_id' in message_identifier:
                 inline_message_id = message_identifier['inline_message_id']
+        if isinstance(text, dict):
+            user_record = self.db['users'].find_one(telegram_id=chat_id)
+            text = self.get_message(
+                update=update,
+                user_record=user_record,
+                messages=text
+            )
         for i, (text_chunk, is_last) in enumerate(
             self.split_message_text(
                 text=text,