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:
4
bot/handlers/system/__init__.py
Normal file
4
bot/handlers/system/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .common import router as common_router
|
||||
from .prehandling import router as prehandling_router
|
||||
|
||||
routers = [common_router, prehandling_router]
|
||||
19
bot/handlers/system/common.py
Normal file
19
bot/handlers/system/common.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from aiogram import F, Router
|
||||
from aiogram.fsm.context import FSMContext
|
||||
from aiogram.types import CallbackQuery, Message
|
||||
|
||||
from bot.texts import UNDEFINED_MESSAGE
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.message()
|
||||
async def undefined_cmd(msg: Message):
|
||||
await msg.delete()
|
||||
await msg.answer(UNDEFINED_MESSAGE)
|
||||
|
||||
|
||||
@router.callback_query(F.data == "delete")
|
||||
async def delete_cb(cb: CallbackQuery, state: FSMContext):
|
||||
await state.clear()
|
||||
await cb.message.delete()
|
||||
9
bot/handlers/system/prehandling.py
Normal file
9
bot/handlers/system/prehandling.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from aiogram import F, Router
|
||||
from aiogram.types import Message
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.message(F.chat.type != "private")
|
||||
async def prehandle_non_private(msg: Message):
|
||||
return
|
||||
Reference in New Issue
Block a user