From e1ecb6a1dcef09cf61143fdeede53c340f88f0c7 Mon Sep 17 00:00:00 2001 From: Capybara-z Date: Sat, 12 Apr 2025 19:48:55 +0300 Subject: [PATCH] Fix admin button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Исправлено отображение кнопки админа при активации купона на деньги --- handlers/coupons.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/handlers/coupons.py b/handlers/coupons.py index 95e41374..fb4cc2f3 100644 --- a/handlers/coupons.py +++ b/handlers/coupons.py @@ -9,6 +9,7 @@ import pytz import html from datetime import datetime +from config import ADMIN_ID from database import ( check_coupon_usage, create_coupon_usage, @@ -100,7 +101,8 @@ async def activate_coupon( await update_coupon_usage_count(coupon_record["id"], session) await create_coupon_usage(coupon_record["id"], user_id, session) await message.answer(f"✅ Купон активирован, на баланс начислено {coupon_record['amount']} рублей.") - await process_callback_view_profile(message, state, admin) + is_admin = message.from_user.id in ADMIN_ID + await process_callback_view_profile(message, state, admin=is_admin) await state.clear() except Exception as e: logger.error(f"Ошибка при активации купона на баланс: {e}") @@ -212,4 +214,4 @@ async def handle_key_extension(callback_query: CallbackQuery, state: FSMContext, async def cancel_coupon_activation(callback_query: CallbackQuery, state: FSMContext, admin: bool = False): await callback_query.message.edit_text("⚠️ Активация купона отменена.") await process_callback_view_profile(callback_query.message, state, admin) - await state.clear() \ No newline at end of file + await state.clear()