Refactor bot username retrieval in bulk promo code creation
- Updated the logic to retrieve the bot username dynamically, enhancing the accuracy of CSV links for promo codes. - Improved error handling to log failures in fetching the bot username, ensuring better traceability. - Adjusted the promo code service initialization in the start command handler to use the message context, improving consistency in bot interactions.
This commit is contained in:
@@ -224,7 +224,7 @@ async def start_command_handler(message: types.Message,
|
||||
if promo_code_to_apply:
|
||||
try:
|
||||
from bot.services.promo_code_service import PromoCodeService
|
||||
promo_code_service = PromoCodeService(settings, subscription_service, bot, i18n)
|
||||
promo_code_service = PromoCodeService(settings, subscription_service, message.bot, i18n)
|
||||
|
||||
success, result = await promo_code_service.apply_promo_code(
|
||||
session, user_id, promo_code_to_apply, current_lang
|
||||
|
||||
Reference in New Issue
Block a user