feat: Implement core bot logic

- Implements the central orchestrator in `app/main.py` using `python-telegram-bot`.
- Integrates the `permissions` module to determine user roles based on chat IDs.
- Implements the `onboarding` module to provide role-based menus with inline keyboards.
- Adds a `CallbackQueryHandler` to handle button presses from the inline keyboards.
- Updates `tasks.md` to reflect the completion of Phase 2.
This commit is contained in:
google-labs-jules[bot]
2025-12-15 19:26:16 +00:00
parent 95f51d42a2
commit f1fcc0ee93
3 changed files with 92 additions and 15 deletions

View File

@@ -1,9 +1,42 @@
# app/modules/onboarding.py
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
def handle_start(chat_id):
def get_owner_menu():
"""Returns the main menu for the owner."""
keyboard = [
[InlineKeyboardButton("📅 Ver mi agenda", callback_data='view_agenda')],
[InlineKeyboardButton("⏳ Ver pendientes", callback_data='view_pending')],
[InlineKeyboardButton("✅ Aprobar solicitud", callback_data='approve_request')],
]
return InlineKeyboardMarkup(keyboard)
def get_team_menu():
"""Returns the main menu for a team member."""
keyboard = [
[InlineKeyboardButton("🕒 Proponer actividad", callback_data='propose_activity')],
[InlineKeyboardButton("📄 Ver estatus de solicitudes", callback_data='view_requests_status')],
]
return InlineKeyboardMarkup(keyboard)
def get_client_menu():
"""Returns the main menu for a client."""
keyboard = [
[InlineKeyboardButton("🗓️ Agendar una cita", callback_data='schedule_appointment')],
[InlineKeyboardButton(" Información de servicios", callback_data='get_service_info')],
]
return InlineKeyboardMarkup(keyboard)
def handle_start(user_role):
"""
Handles the /start command and sends a welcome message.
Handles the /start command and sends a role-based welcome message and menu.
"""
print(f"[{chat_id}] Handling start command...")
# TODO: Implement welcome message and main menu
return "Welcome to Talía!"
welcome_message = "Hola, soy Talía. ¿En qué puedo ayudarte hoy?"
if user_role == "owner":
menu = get_owner_menu()
elif user_role in ["admin", "team"]:
menu = get_team_menu()
else: # client
menu = get_client_menu()
return welcome_message, menu