diff --git a/handlers/notifications/general_notifications.py b/handlers/notifications/general_notifications.py index 87d72713..4c26d80a 100644 --- a/handlers/notifications/general_notifications.py +++ b/handlers/notifications/general_notifications.py @@ -47,6 +47,7 @@ from handlers.texts import ( ) from handlers.utils import format_hours, format_minutes from logger import logger +from handlers.utils import format_hours, format_months, format_minutes from .notify_utils import send_messages_with_limit, send_notification from .special_notifications import notify_inactive_trial_users, notify_users_no_traffic @@ -419,7 +420,9 @@ async def process_auto_renew_or_notify( ) renewed_message = KEY_RENEWED.format( - email=email, months=renewal_period_months, expiry_date=formatted_expiry_date + email=email, + months_formatted=months_formatted, + expiry_date=formatted_expiry_date ) keyboard = build_notification_expired_kb() diff --git a/handlers/notifications/special_notifications.py b/handlers/notifications/special_notifications.py index bbfb9a8f..910b63bb 100644 --- a/handlers/notifications/special_notifications.py +++ b/handlers/notifications/special_notifications.py @@ -20,6 +20,7 @@ from handlers.keys.key_utils import get_user_traffic from handlers.texts import TRIAL_INACTIVE_BONUS_MSG, TRIAL_INACTIVE_FIRST_MSG, ZERO_TRAFFIC_MSG from handlers.utils import format_days from logger import logger +from handlers.utils import format_days from .notify_utils import send_messages_with_limit, send_notification diff --git a/handlers/utils.py b/handlers/utils.py index 7aeec6e9..9bc59208 100644 --- a/handlers/utils.py +++ b/handlers/utils.py @@ -146,6 +146,18 @@ def format_days(days: int) -> str: return "0 дней" return f"{days} {get_plural_form(days, 'день', 'дня', 'дней')}" +def format_hours(hours: int) -> str: + """Форматирует количество часов с правильным склонением""" + if hours <= 0: + return "0 часов" + return f"{hours} {get_plural_form(hours, 'час', 'часа', 'часов')}" + +def format_minutes(minutes: int) -> str: + """Форматирует количество минут с правильным склонением""" + if minutes <= 0: + return "0 минут" + return f"{minutes} {get_plural_form(minutes, 'минута', 'минуты', 'минут')}" + def format_hours(hours: int) -> str: """Форматирует количество часов с правильным склонением"""