Files
seoulmate_bot_v1/services/bot/app/main.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

29 lines
1.4 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.ext import Application, CommandHandler
from app.core.config import settings
from app.handlers.conversation import build_conversation
from app.handlers.admin import add_admin_handler, list_candidates_handler, verify_candidate_handler, view_candidate_handler
from app.handlers.profile import my_profile_handler, edit_hint_handler
async def start_cmd(update, context):
await update.message.reply_text("Бот запущен. Набери /new, чтобы заполнить анкету.")
def build_app() -> Application:
app = Application.builder().token(settings.BOT_TOKEN).build()
# Хендлеры
app.add_handler(build_conversation())
app.add_handler(CommandHandler("start", start_cmd))
app.add_handler(CommandHandler("my", my_profile_handler))
app.add_handler(CommandHandler("edit", edit_hint_handler))
app.add_handler(CommandHandler("addadmin", add_admin_handler))
app.add_handler(CommandHandler("candidates", list_candidates_handler))
app.add_handler(CommandHandler("verify", verify_candidate_handler))
app.add_handler(CommandHandler("view", view_candidate_handler))
return app
if __name__ == "__main__":
application = build_app()
# В v21 это блокирующий вызов; updater больше не используется.
application.run_polling(close_loop=False)