mirror of
https://github.com/olegvodyanov/docbot.git
synced 2026-02-02 02:45:46 +03:00
meet doctor logic
This commit is contained in:
parent
4b9f9f944f
commit
53ab694f5f
36
src/docbot/handlers/doctors/meet_doctor_handler.py
Normal file
36
src/docbot/handlers/doctors/meet_doctor_handler.py
Normal 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,
|
||||||
|
)
|
||||||
|
|
||||||
@ -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."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user