Fix admin button

- Исправлено отображение кнопки админа при активации купона на деньги
This commit is contained in:
Capybara-z
2025-04-12 19:48:55 +03:00
committed by GitHub
parent 99c02874ec
commit e1ecb6a1dc
+4 -2
View File
@@ -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()
await state.clear()