From c5f41a261b79b732853880eb9b7cd89233826f91 Mon Sep 17 00:00:00 2001 From: machka-pasla Date: Tue, 5 Aug 2025 14:43:19 +0300 Subject: [PATCH] Update promo code success message and enhance subscription service settings - Revised the success message for promo code creation to include updated variable names for clarity in the response. - Added a new setting to control notification behavior for Tribute payments, improving customization options for subscription management. - Updated Russian localization for admin panel buttons to enhance clarity and consistency in user interface elements. --- bot/handlers/admin/promo_codes.py | 8 ++++---- bot/services/subscription_service.py | 2 +- config/settings.py | 1 + locales/ru.json | 10 +++++----- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bot/handlers/admin/promo_codes.py b/bot/handlers/admin/promo_codes.py index 525d495..aacf286 100644 --- a/bot/handlers/admin/promo_codes.py +++ b/bot/handlers/admin/promo_codes.py @@ -369,11 +369,11 @@ async def create_promo_code_final(callback_or_message, # Send success message success_text = _( "admin_promo_created_success", - default="✅ Промокод создан!\n\n🎟 Код: {code}\n🎁 Бонусные дни: {days}\n🔢 Максимальные активации: {max_act}\n⏰ Действует до: {validity}", + default="✅ Промокод создан!\n\n🎟 Код: {code}\n🎁 Бонусные дни: {bonus_days}\n🔢 Максимальные активации: {max_activations}\n⏰ Действует до: {valid_until_str}", code=promo_code, - days=bonus_days, - max_act=max_activations, - validity=valid_until_str_display + bonus_days=bonus_days, + max_activations=max_activations, + valid_until_str=valid_until_str_display ) if hasattr(callback_or_message, 'message'): diff --git a/bot/services/subscription_service.py b/bot/services/subscription_service.py index ffcb678..0be251b 100644 --- a/bot/services/subscription_service.py +++ b/bot/services/subscription_service.py @@ -482,7 +482,7 @@ class SubscriptionService: "status_from_panel": "ACTIVE", "traffic_limit_bytes": self.settings.user_traffic_limit_bytes, "provider": provider, - "skip_notifications": provider == "tribute", + "skip_notifications": provider == "tribute" and self.settings.TRIBUTE_SKIP_NOTIFICATIONS, } try: new_or_updated_sub = await subscription_dal.upsert_subscription( diff --git a/config/settings.py b/config/settings.py index ac6f649..8b7a07a 100644 --- a/config/settings.py +++ b/config/settings.py @@ -66,6 +66,7 @@ class Settings(BaseSettings): TRIBUTE_LINK_6_MONTHS: Optional[str] = Field(default=None) TRIBUTE_LINK_12_MONTHS: Optional[str] = Field(default=None) TRIBUTE_API_KEY: Optional[str] = Field(default=None) + TRIBUTE_SKIP_NOTIFICATIONS: bool = Field(default=True, description="Skip renewal notifications for Tribute payments") PANEL_WEBHOOK_SECRET: Optional[str] = Field(default=None) SUBSCRIPTION_NOTIFICATIONS_ENABLED: bool = Field(default=True) diff --git a/locales/ru.json b/locales/ru.json index 2f1cb06..a0389c8 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -244,12 +244,12 @@ "admin_user_subscription_info": "Информация о подписке:", "admin_user_reset_trial_button": "🔄 Сбросить триал", "admin_user_add_subscription_button": "➕ Добавить дни", - "admin_user_toggle_ban_button": "🚫 Заблокировать/Разблокировать", - "admin_user_send_message_button": "✉️ Отправить сообщение", - "admin_user_view_logs_button": "📜 Действия пользователя", + "admin_user_toggle_ban_button": "🚫 Бан/Разбан", + "admin_user_send_message_button": "✉️ Сообщение", + "admin_user_view_logs_button": "📜 Логи", "admin_user_refresh_button": "🔄 Обновить", - "admin_user_search_new_button": "🔍 Найти другого", - "admin_user_view_all_logs_button": "📋 Все действия", + "admin_user_search_new_button": "🔍 Новый поиск", + "admin_user_view_all_logs_button": "📋 Все логи", "admin_user_back_to_card_button": "🔙 К карточке", "admin_user_not_found": "❌ Пользователь не найден: {input}",