meet doctor logic

This commit is contained in:
Oleg Oleg 2026-01-09 19:33:00 +04:00
parent 4b9f9f944f
commit 53ab694f5f
2 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,36 @@
from telegram import Update
from telegram.ext import (
ContextTypes,
ConversationHandler,
CallbackQueryHandler
)
from docbot.handlers.utils.cancel_handler import get_cancel_handler
from docbot.handlers.start_handler import get_start_handler
from core.logging import logger
GET_TERMS_ACKNOWLEDGED = 1
async def show_terms(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
user_id = context.user_data['user_id']
await update.callback_query.message.reply_text(
text="Введите адрес вашей платёжной ссылки, пожалуйста."
)
logger.info(f"Ask user {user_id} to enter their payment link.")
return ConversationHandler.END
def meet_doctor_handler() -> ConversationHandler:
return ConversationHandler(
entry_points=[get_start_handler()],
states={
GET_TERMS_ACKNOWLEDGED: [
CallbackQueryHandler(show_terms, pattern="^(terms:aknowledged)$")
],
},
fallbacks=[get_cancel_handler()],
name="meet_doctor_handler",
persistent=True,
allow_reentry=True,
)

View File

@ -1,11 +1,12 @@
from src.core.enums.dialog_helpers import ConfirmationMessage from docbot.handlers.doctors.meet_doctor_handler import GET_TERMS_ACKNOWLEDGED
from src.docbot.services.doctors_service import get_doctor from src.docbot.services.doctors_service import get_doctor
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.constants import ParseMode from telegram.constants import ParseMode
from telegram.ext import ContextTypes, CommandHandler from telegram.ext import ContextTypes, CommandHandler
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
user_id = update.effective_user.id user_id = update.effective_user.id
@ -41,6 +42,7 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
) )
await context.bot.send_message(chat_id=update.effective_chat.id, text=text, parse_mode=ParseMode.HTML) await context.bot.send_message(chat_id=update.effective_chat.id, text=text, parse_mode=ParseMode.HTML)
return GET_TERMS_ACKNOWLEDGED
def get_start_handler() -> CommandHandler: def get_start_handler() -> CommandHandler:
"""Фабрика для регистрации в Application.""" """Фабрика для регистрации в Application."""