Commit 16a5e16

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-05-13 03:10:03
fix(permission): skip user-only method for bot
1 parent bbb54f9
Changed files (1)
src/permission.py
@@ -8,7 +8,7 @@ from pyrogram.client import Client
 from pyrogram.types import Message
 
 from config import ENABLE, TID, cache
-from utils import to_int, true
+from utils import i_am_bot, to_int, true
 
 
 # ruff: noqa: SIM103
@@ -38,12 +38,12 @@ async def check_category(client: Client, message: Message, ctype: str) -> dict:
         permission["disabled"] = True
     elif ctype == "PRIVATE" and not ENABLE.USERS:
         permission["disabled"] = True
-
+    is_bot = await i_am_bot(client)
     """Mark as read for these cid
     TID_MUTES=111111,234567
     TID_MUTE_111111=true
     """
-    if cid in [slim_cid(x) for x in os.getenv("TID_MUTES", "").split(",")] or true(os.getenv(f"TID_MUTE_{cid}")):
+    if not is_bot and (cid in [slim_cid(x) for x in os.getenv("TID_MUTES", "").split(",")] or true(os.getenv(f"TID_MUTE_{cid}"))):
         await message.read()
 
     """Skip process these chats