Files
seoulmate_bot_v1/services/bot/app/handlers/profile.py
Andrey K. Choi 9af84db429
Some checks reported errors
continuous-integration/drone/push Build encountered an error
MVP ready. Fully functional (registration? moderation, profiles vew)
2025-08-12 21:55:56 +09:00

42 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from __future__ import annotations
from telegram import Update, InputMediaPhoto
from telegram.ext import ContextTypes
from app.core.db import db_session
from app.repositories.candidate_repo import CandidateRepository
from app.utils.common import csv_to_list
async def my_profile_handler(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""Команда /my — показать свою анкету."""
with db_session() as s:
repo = CandidateRepository(s)
c = repo.by_tg(update.effective_user.id)
if not c:
await update.message.reply_text("Анкета не найдена. Начни с /new")
return
text = (
f"Твоя анкета:\n"
f"{c.full_name or ''} (@{update.effective_user.username or ''})\n"
f"Город: {c.city or ''}\n"
f"Цель: {c.goal or ''}"
)
if c.avatar_file_id:
await update.message.reply_photo(photo=c.avatar_file_id, caption=text)
else:
await update.message.reply_text(text)
gallery = csv_to_list(c.gallery_file_ids)
if gallery:
media = [InputMediaPhoto(g) for g in gallery[:10]]
await update.message.reply_media_group(media)
async def edit_hint_handler(update: Update, context: ContextTypes.DEFAULT_TYPE):
"""Команда /edit — пока только подсказка о редактировании."""
await update.message.reply_text(
"Точечное редактирование будет добавлено командами /edit_*. Пока что для правок — /new (перезаполнить анкету)."
)