Refactor promo code creation process and remove unnecessary handlers

- Updated the promo code creation flow to a four-step process, enhancing user guidance and validation.
- Removed the optional description step from the promo code creation, streamlining the process.
- Updated localization files to reflect changes in the promo code creation steps and success messages.
- Enhanced error handling and logging for panel statistics retrieval in the admin statistics handler.
This commit is contained in:
machka-pasla
2025-08-03 18:44:12 +03:00
parent 4f6822f8e4
commit 973e97c54e
6 changed files with 59 additions and 318 deletions
+6 -2
View File
@@ -363,8 +363,10 @@ async def handle_toggle_ban(callback: types.CallbackQuery, user: User,
# Refresh user card with updated ban status
user.is_banned = new_ban_status # Update local object
from config.settings import Settings
from bot.services.panel_api_service import PanelApiService
settings = Settings()
subscription_service = SubscriptionService(settings)
panel_service = PanelApiService(settings)
subscription_service = SubscriptionService(settings, panel_service)
await handle_refresh_user_card(callback, user, subscription_service, session, i18n_instance, lang)
except Exception as e:
@@ -628,7 +630,9 @@ async def process_direct_message_handler(message: types.Message, state: FSMConte
))
# Show user card again
subscription_service = SubscriptionService(settings)
from bot.services.panel_api_service import PanelApiService
panel_service = PanelApiService(settings)
subscription_service = SubscriptionService(settings, panel_service)
user_card_text = await format_user_card(target_user, session, subscription_service, i18n, current_lang)
keyboard = get_user_card_keyboard(target_user.user_id, i18n, current_lang)