Refactor bot handlers and keyboards; implement admin features
- Removed unused prehandling, referrals, support, and states files. - Updated admin and client handlers to improve structure and functionality. - Introduced admin filters and routers for better access control. - Added new billing and deposit functionalities for client interactions. - Enhanced keyboard layouts for admin and client menus. - Implemented promotion handling for admin users. - Updated configuration to include admin settings. - Improved utility functions for quote fetching and menu text building. - Added common handlers for undefined commands and message deletions.
This commit is contained in:
28
bot/handlers/client/referals.py
Normal file
28
bot/handlers/client/referals.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from aiogram import F, Router
|
||||
from aiogram.fsm.context import FSMContext
|
||||
from aiogram.types import CallbackQuery
|
||||
from aiogram.utils.deep_linking import create_start_link
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from bot.keyboards.client import referals_kb
|
||||
from bot.texts import REFERALS_MENU
|
||||
from misc.utils import format_share_deep_link
|
||||
from schemas.di import DependenciesDTO
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.callback_query(F.data == "referal")
|
||||
async def referal_menu(
|
||||
cb: CallbackQuery, state: FSMContext, session: AsyncSession, deps: DependenciesDTO
|
||||
):
|
||||
await state.clear()
|
||||
|
||||
user = await deps.user_repository.get_user_by_id(session, cb.from_user.id)
|
||||
referal_link = await create_start_link(cb.bot, f"ref_{user.id}", encode=True)
|
||||
share_link = format_share_deep_link(referal_link)
|
||||
|
||||
await cb.message.edit_text(
|
||||
REFERALS_MENU.format(balance=user.balance, link=referal_link),
|
||||
reply_markup=referals_kb(share_link),
|
||||
)
|
||||
Reference in New Issue
Block a user