From 5f46156907c5a6377c42a60b8910a9bc867fc5dd Mon Sep 17 00:00:00 2001 From: Vladless Date: Sun, 3 Nov 2024 01:49:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F.=20=D0=9F=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handlers/notifications.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handlers/notifications.py b/handlers/notifications.py index 4680361a..fe7e15ca 100644 --- a/handlers/notifications.py +++ b/handlers/notifications.py @@ -5,7 +5,7 @@ from aiogram import Bot, Router from aiogram.fsm.state import State, StatesGroup import logging from config import DATABASE_URL, ADMIN_USERNAME, ADMIN_PASSWORD, SERVERS -from database import get_balance, update_key_expiry, delete_key +from database import get_balance, update_key_expiry, delete_key, update_balance from client import extend_client_key, delete_client from auth import login_with_credentials from handlers.texts import KEY_EXPIRY_10H, KEY_EXPIRY_24H, KEY_RENEWED, KEY_RENEWAL_FAILED, KEY_DELETED, KEY_DELETION_FAILED @@ -147,6 +147,7 @@ async def handle_expired_keys(bot: Bot, conn: asyncpg.Connection, current_time: keyboard = types.InlineKeyboardMarkup(inline_keyboard=[[button_profile]]) if balance >= 100: + update_balance(tg_id, 100) new_expiry_time = int((datetime.utcnow() + timedelta(days=30)).timestamp() * 1000) await update_key_expiry(client_id, new_expiry_time) logger.info(f"Ключ для клиента {tg_id} продлен до {datetime.utcfromtimestamp(new_expiry_time / 1000).strftime('%Y-%m-%d %H:%M:%S')}.")