mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
feat: Implement Phase 3 modules
- Implements placeholder logic for the `agenda`, `citas`, `equipo`, `aprobaciones`, and `servicios` modules. - Integrates all new module functions into the `button` handler in `app/main.py` to make the bot's menus functional. - Fixes a newline formatting bug in the text responses to ensure they render correctly in Telegram. - Updates `tasks.md` to reflect the progress on Phase 3.
This commit is contained in:
30
app/main.py
30
app/main.py
@@ -6,6 +6,11 @@ from telegram.ext import Application, CommandHandler, CallbackQueryHandler, Cont
|
||||
from config import TELEGRAM_BOT_TOKEN
|
||||
from permissions import get_user_role
|
||||
from modules.onboarding import handle_start as onboarding_handle_start
|
||||
from modules.agenda import get_agenda
|
||||
from modules.citas import request_appointment
|
||||
from modules.equipo import propose_activity, view_requests_status
|
||||
from modules.aprobaciones import approve_request, view_pending
|
||||
from modules.servicios import get_service_info
|
||||
|
||||
# Enable logging
|
||||
logging.basicConfig(
|
||||
@@ -26,11 +31,30 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
await update.message.reply_text(response_text, reply_markup=reply_markup)
|
||||
|
||||
async def button(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
"""Parses the CallbackQuery and updates the message text."""
|
||||
"""Parses the CallbackQuery and calls the appropriate module."""
|
||||
query = update.callback_query
|
||||
await query.answer()
|
||||
# TODO: Implement handlers for the different callback queries
|
||||
await query.edit_message_text(text=f"Selected option: {query.data}")
|
||||
|
||||
logger.info(f"Received callback query: {query.data}")
|
||||
|
||||
response_text = "Acción no reconocida."
|
||||
|
||||
if query.data == 'view_agenda':
|
||||
response_text = get_agenda()
|
||||
elif query.data == 'view_pending':
|
||||
response_text = view_pending()
|
||||
elif query.data == 'approve_request':
|
||||
response_text = approve_request()
|
||||
elif query.data == 'propose_activity':
|
||||
response_text = propose_activity()
|
||||
elif query.data == 'view_requests_status':
|
||||
response_text = view_requests_status()
|
||||
elif query.data == 'schedule_appointment':
|
||||
response_text = request_appointment()
|
||||
elif query.data == 'get_service_info':
|
||||
response_text = get_service_info()
|
||||
|
||||
await query.edit_message_text(text=response_text, parse_mode='Markdown')
|
||||
|
||||
def main() -> None:
|
||||
"""Start the bot."""
|
||||
|
||||
Reference in New Issue
Block a user