Commit d1edd6c

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-05-29 02:43:24
chore(status): trim very long texts in progress message
1 parent bb5a987
Changed files (1)
src
messages
src/messages/progress.py
@@ -9,7 +9,7 @@ from pyrogram.errors import FloodWait, MessageNotModified
 from pyrogram.types import Message
 
 from config import TEXT_LENGTH, cache
-from messages.utils import count_without_entities, smart_split
+from messages.utils import smart_split
 
 
 async def modify_progress(
@@ -57,9 +57,10 @@ async def modify_progress(
             detail_progress = True
         if not detail_progress:
             return
-        logger.trace(f"Progress: {text!r}")
-        if len(text) > TEXT_LENGTH and await count_without_entities(text) > TEXT_LENGTH:
+        if len(text) > TEXT_LENGTH:
+            text = text[: 2 * TEXT_LENGTH]  # trim the very long texts
             text = (await smart_split(text))[0]
+        logger.trace(f"Progress: {text!r}")
         await message.edit_text(text)
         cache.set("modify_progress", "1", ttl=ttl)
     except FloodWait as e: