feat: Reorganized project, added user registration, throttling middleware, help command, profile command

This commit is contained in:
ITQ
2024-03-20 20:53:43 +03:00
parent 7086a1cf52
commit 6d755490d6
21 changed files with 603 additions and 44 deletions
+31
View File
@@ -0,0 +1,31 @@
# type: ignore
__all__ = ()
from aiogram import Router
from aiogram.filters import Command
from aiogram.types import Message
from app import messages
from app.filters.user_filter import Registered
from app.keyboards.profile import get
from app.models.user import User
router = Router(name="profile_command")
@router.message(Command("profile"), Registered())
async def command_profile_handler(message: Message) -> None:
user = User().get_user_by_telegram_id(message.from_user.id)
await message.answer(
messages.PROFILE.format(
username=user.username,
age=user.age,
bio=user.bio if user.bio else messages.NOT_SET,
sex=user.sex.capitalize(),
country=user.country,
city=user.city,
),
reply_markup=get(),
)