From 0250410ca754b8f24594df608536bcf085dd1efa Mon Sep 17 00:00:00 2001
From: Roman Sergienko <romasergienko@outlook.com>
Date: Sun, 11 Oct 2026 16:29:50 +0000
Subject: [PATCH] feat web: чат пузырями (свои/чужие), превью реплаев, подгрузка фото/стикеров/медиа через бота

---
 mod.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/mod.py b/mod.py
index ca36c64..9adda98 100644
--- a/mod.py
+++ b/mod.py
@@ -21,8 +21,10 @@
 
 # --- Ядро действий ---
 
-async def apply_mute(chat_id: int, user_id: int, name: str, until: Optional[int], admin_id: int, reason: str) -> bool:
+async def apply_mute(chat_id: int, user_id: int, name: str, dur: Optional[int], admin_id: int, reason: str) -> bool:
+    # dur — длительность в секундах (None или 0 = бессрочно). until_date — абсолютное время.
     ts = now_ts()
+    until = None if not dur else ts + dur
     try:
         await bot.restrict_chat_member(chat_id, user_id, permissions=NO_PERMS, until_date=until)
     except Exception as e:
@@ -30,12 +32,13 @@
         return False
     await db.add_punish(chat_id, user_id, "mute", admin_id, reason, ts, until)
     await db.add_log(chat_id, admin_id, user_id, "mute", reason, ts)
-    await _notice(chat_id, f"Пользователь {mention(user_id, name)} замучен на {fmt_dur(until)}. Причина: {reason or '-'}")
+    await _notice(chat_id, f"Пользователь {mention(user_id, name)} замучен на {fmt_dur(dur)}. Причина: {reason or '-'}")
     return True
 
 
-async def apply_ban(chat_id: int, user_id: int, name: str, until: Optional[int], admin_id: int, reason: str) -> bool:
+async def apply_ban(chat_id: int, user_id: int, name: str, dur: Optional[int], admin_id: int, reason: str) -> bool:
     ts = now_ts()
+    until = None if not dur else ts + dur
     try:
         await bot.ban_chat_member(chat_id, user_id)
     except Exception as e:
@@ -43,7 +46,7 @@
         return False
     await db.add_punish(chat_id, user_id, "ban", admin_id, reason, ts, until)
     await db.add_log(chat_id, admin_id, user_id, "ban", reason, ts)
-    await _notice(chat_id, f"Пользователь {mention(user_id, name)} забанен на {fmt_dur(until)}. Причина: {reason or '-'}")
+    await _notice(chat_id, f"Пользователь {mention(user_id, name)} забанен на {fmt_dur(dur)}. Причина: {reason or '-'}")
     return True
 
 

--
Gitblit v1.9.3