From 54923177ac30c5fed278c0c536286ede670b40a0 Mon Sep 17 00:00:00 2001 From: Capybara-z Date: Tue, 18 Feb 2025 10:19:05 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D1=87=D0=B0=D1=81?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - фискс отображения когда остаются только часы --- handlers/keys/subscriptions.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/handlers/keys/subscriptions.py b/handlers/keys/subscriptions.py index 75a416be..8128e2d6 100644 --- a/handlers/keys/subscriptions.py +++ b/handlers/keys/subscriptions.py @@ -157,9 +157,11 @@ async def handle_subscription(request, old_subscription=False): if len(parts) >= 3: candidate = parts[-1] candidate_decoded = urllib.parse.unquote(candidate) - match = re.search(r'(\d+D,\d+H)', candidate_decoded) + match = re.search(r'(?:(\d+D,))?(\d+H)', candidate_decoded) if match: - time_left = match.group(1) + "⏳" + day_part = match.group(1) or "" + hour_part = match.group(2) + time_left = (day_part + hour_part).strip() + " ⏳" break if not time_left: time_left = "N/A" @@ -183,7 +185,7 @@ async def handle_subscription(request, old_subscription=False): if "Happ" in user_agent: encoded_project_name = f"{PROJECT_NAME}" support_username = SUPPORT_CHAT_URL.split("https://t.me/")[-1] - announce_str = f"Поддержка @{support_username} 🔗(Справа)\n\nБот @{USERNAME_BOT} ⓘ(Слева)\n\n📄 Подписка: {email} - {time_left}" + announce_str = f"Поддержка @{support_username} 🔗(Справа)\n📄 Подписка: {email} - {time_left}\nБот @{USERNAME_BOT} ⓘ(Слева)" headers = { "Content-Type": "text/plain; charset=utf-8", "Content-Disposition": "inline",