Initial Commit
This commit is contained in:
32
handlers/client.py
Normal file
32
handlers/client.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from aiogram import Router
|
||||
from aiogram.types import Message
|
||||
from aiogram.filters import Command
|
||||
from aiogram.fsm.context import FSMContext
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from misc.kb import main_menu_kb
|
||||
from services.orders import OrderService
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.message(Command("start"))
|
||||
async def main_menu(msg: Message, state: FSMContext):
|
||||
await state.clear()
|
||||
|
||||
await msg.answer(
|
||||
"hii!", reply_markup=await main_menu_kb(msg.from_user.id)
|
||||
) # TODO: Write a welcome message
|
||||
|
||||
|
||||
@router.message(Command("orders"))
|
||||
async def get_orders(
|
||||
msg: Message,
|
||||
state: FSMContext,
|
||||
order_service: OrderService,
|
||||
session: AsyncSession,
|
||||
):
|
||||
await state.clear()
|
||||
|
||||
count = await order_service.get_order_count(session, msg.from_user.id)
|
||||
await msg.answer(f"you have {count} orders.")
|
||||
Reference in New Issue
Block a user