Init project

This commit is contained in:
2026-01-15 09:47:43 +03:00
commit 3e515c66ec
59 changed files with 5101 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import datetime
import re
from aiogram import types
from aiogram.types import User as TelegramUser
BIRTHDATE_REGEXP = re.compile("^(?P<day>\d{2})\.(?P<month>\d{2})\.(?P<year>\d{4})$")
def parse_date(message: types.Message) -> datetime.date:
if (re_match := BIRTHDATE_REGEXP.match(message.text)) is None:
return
return datetime.date(
year=int(re_match.group("year")),
month=int(re_match.group("month")),
day=int(re_match.group("day")),
)
def get_telegram_user_full_name(user: TelegramUser) -> str:
name_parts = (user.first_name, user.last_name)
return " ".join(filter(None, name_parts))