From f9e29f4fa989739b084aa72c1b422136afaa3e0b Mon Sep 17 00:00:00 2001 From: Zakhar Izmaylov Date: Sun, 24 Nov 2024 23:45:27 +0300 Subject: [PATCH] Refactor notification and profile handlers to include RENEWAL_PLANS from config. Update key management and keys handlers to streamline imports and enhance code organization. --- handlers/keys/key_management.py | 4 ++-- handlers/keys/keys.py | 3 +-- handlers/notifications.py | 4 ++-- handlers/profile.py | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/handlers/keys/key_management.py b/handlers/keys/key_management.py index 780a7e71..f4e0057e 100644 --- a/handlers/keys/key_management.py +++ b/handlers/keys/key_management.py @@ -9,7 +9,7 @@ from aiogram.fsm.state import State, StatesGroup from aiogram.types import CallbackQuery, InlineKeyboardButton, Message from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, PUBLIC_LINK, SUPPORT_CHAT_URL +from config import CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, PUBLIC_LINK, SUPPORT_CHAT_URL,RENEWAL_PLANS from database import ( add_connection, check_connection_exists, @@ -20,7 +20,7 @@ from database import ( use_trial, ) from handlers.keys.key_utils import create_key_on_cluster -from handlers.texts import KEY, KEY_TRIAL, NULL_BALANCE, RENEWAL_PLANS, key_message_success +from handlers.texts import KEY, KEY_TRIAL, NULL_BALANCE, key_message_success from handlers.utils import get_least_loaded_cluster, sanitize_key_name from logger import logger diff --git a/handlers/keys/keys.py b/handlers/keys/keys.py index 689526bf..a839dcbd 100644 --- a/handlers/keys/keys.py +++ b/handlers/keys/keys.py @@ -8,7 +8,7 @@ from aiogram import F, Router, types from aiogram.types import BufferedInputFile, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import CLUSTERS, CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, PUBLIC_LINK, TOTAL_GB +from config import CLUSTERS, CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, PUBLIC_LINK, TOTAL_GB,RENEWAL_PLANS from database import delete_key, get_balance, store_key, update_balance, update_key_expiry from handlers.keys.key_utils import ( delete_key_from_cluster, @@ -21,7 +21,6 @@ from handlers.texts import ( KEY_NOT_FOUND_MSG, NO_KEYS, PLAN_SELECTION_MSG, - RENEWAL_PLANS, SUCCESS_RENEWAL_MSG, key_message, ) diff --git a/handlers/notifications.py b/handlers/notifications.py index 613f940a..1400ef0d 100644 --- a/handlers/notifications.py +++ b/handlers/notifications.py @@ -7,7 +7,7 @@ import asyncpg from py3xui import AsyncApi from client import delete_client -from config import ADMIN_PASSWORD, ADMIN_USERNAME, CLUSTERS, DATABASE_URL, TOTAL_GB, TRIAL_TIME +from config import ADMIN_PASSWORD, ADMIN_USERNAME, CLUSTERS, DATABASE_URL, TOTAL_GB, TRIAL_TIME,RENEWAL_PLANS from database import ( add_notification, check_notification_time, @@ -17,7 +17,7 @@ from database import ( update_key_expiry, ) from handlers.keys.key_utils import renew_key_in_cluster -from handlers.texts import KEY_EXPIRY_10H, KEY_EXPIRY_24H, KEY_RENEWED, RENEWAL_PLANS +from handlers.texts import KEY_EXPIRY_10H, KEY_EXPIRY_24H, KEY_RENEWED from logger import logger router = Router() diff --git a/handlers/profile.py b/handlers/profile.py index e4d67c20..8bb0fe55 100644 --- a/handlers/profile.py +++ b/handlers/profile.py @@ -5,9 +5,9 @@ from aiogram.fsm.context import FSMContext from aiogram.types import BufferedInputFile, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import CHANNEL_URL +from config import CHANNEL_URL,RENEWAL_PLANS from database import get_balance, get_key_count, get_referral_stats -from handlers.texts import RENEWAL_PLANS, get_referral_link, invite_message_send, profile_message_send +from handlers.texts import get_referral_link, invite_message_send, profile_message_send router = Router()