fix comand
This commit is contained in:
@@ -37,6 +37,10 @@ class AuthManager:
|
|||||||
def is_authenticated(self, user_id: int) -> bool:
|
def is_authenticated(self, user_id: int) -> bool:
|
||||||
if user_id not in self._sessions:
|
if user_id not in self._sessions:
|
||||||
return False
|
return False
|
||||||
|
# Обычные пользователи — сессия бесконечная
|
||||||
|
if self._roles.get(user_id) != "admin":
|
||||||
|
return True
|
||||||
|
# Админы — таймаут применяется
|
||||||
if datetime.now() - self._sessions[user_id] > self._session_timeout:
|
if datetime.now() - self._sessions[user_id] > self._session_timeout:
|
||||||
self.logout(user_id)
|
self.logout(user_id)
|
||||||
return False
|
return False
|
||||||
|
|||||||
+10
-7
@@ -2952,18 +2952,21 @@ class BotInterface:
|
|||||||
|
|
||||||
cost = int(value * settings.CLICK_PRICE_RUB)
|
cost = int(value * settings.CLICK_PRICE_RUB)
|
||||||
|
|
||||||
# Сохраняем для шага подтверждения
|
|
||||||
self._payment_confirm[user_id] = {"clicks": value, "rub": cost}
|
self._payment_confirm[user_id] = {"clicks": value, "rub": cost}
|
||||||
|
rub_bal = await self.rub_storage.get_balance(user_id)
|
||||||
|
|
||||||
builder = InlineKeyboardBuilder()
|
builder = InlineKeyboardBuilder()
|
||||||
builder.row(
|
if rub_bal >= cost:
|
||||||
InlineKeyboardButton(text="✅ Подтвердить", callback_data="confirm_buy"),
|
builder.row(InlineKeyboardButton(
|
||||||
InlineKeyboardButton(text="❌ Отмена", callback_data="cancel_confirm_buy"),
|
text=f"💰 С баланса ({rub_bal} ₽)",
|
||||||
)
|
callback_data="pay_from_balance"
|
||||||
|
))
|
||||||
|
builder.row(InlineKeyboardButton(text="💳 Оплатить криптой", callback_data="confirm_buy"))
|
||||||
|
builder.row(InlineKeyboardButton(text="❌ Отмена", callback_data="cancel_confirm_buy"))
|
||||||
await _edit_prompt(
|
await _edit_prompt(
|
||||||
f"🛒 Подтвердите покупку\n\n"
|
f"🛒 Подтвердите покупку\n\n"
|
||||||
f"🔢 {value} переходов\n"
|
f"🔢 {value} переходов × {fmt_price(settings.CLICK_PRICE_RUB)} ₽ = {cost} ₽"
|
||||||
f"💰 Стоимость: {cost} ₽",
|
+ (f"\n\n🪙 Ваш баланс: {rub_bal} ₽" if rub_bal > 0 else ""),
|
||||||
builder.as_markup()
|
builder.as_markup()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user