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."""
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
# app/modules/agenda.py
|
||||
|
||||
def get_agenda(chat_id):
|
||||
def get_agenda():
|
||||
"""
|
||||
Fetches and displays the user's agenda.
|
||||
Fetches and displays the user's agenda for today.
|
||||
For now, it returns a hardcoded sample agenda.
|
||||
"""
|
||||
print(f"[{chat_id}] Fetching agenda...")
|
||||
# TODO: Implement agenda logic
|
||||
return "Here is your agenda for today."
|
||||
# TODO: Fetch agenda from Google Calendar
|
||||
agenda_text = (
|
||||
"📅 *Agenda para Hoy*\n\n"
|
||||
"• *10:00 AM - 11:00 AM*\n"
|
||||
" Reunión de Sincronización - Proyecto A\n\n"
|
||||
"• *12:30 PM - 1:30 PM*\n"
|
||||
" Llamada con Cliente B\n\n"
|
||||
"• *4:00 PM - 5:00 PM*\n"
|
||||
" Bloque de trabajo profundo - Desarrollo Talía"
|
||||
)
|
||||
return agenda_text
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
# app/modules/aprobaciones.py
|
||||
|
||||
def approve_request(request_id):
|
||||
def approve_request():
|
||||
"""
|
||||
Approves a request.
|
||||
Handles the owner's action to approve a request.
|
||||
"""
|
||||
print(f"Approving request {request_id}...")
|
||||
# TODO: Implement approval logic
|
||||
return "Request approved."
|
||||
# TODO: Implement the full approval workflow
|
||||
return "Has seleccionado aprobar una solicitud. Aquí tienes las solicitudes pendientes:\n\n[Lista de solicitudes...]"
|
||||
|
||||
def reject_request(request_id):
|
||||
def view_pending():
|
||||
"""
|
||||
Rejects a request.
|
||||
Shows the owner a list of pending requests.
|
||||
"""
|
||||
print(f"Rejecting request {request_id}...")
|
||||
# TODO: Implement rejection logic
|
||||
return "Request rejected."
|
||||
# TODO: Fetch pending requests
|
||||
return "⏳ *Solicitudes Pendientes*\n\n- *Grabación de proyecto (4h)* - Solicitado por: Miembro del equipo A\n- *Taller de guion (2h)* - Solicitado por: Miembro del equipo B"
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
# app/modules/citas.py
|
||||
|
||||
def request_appointment(chat_id, requested_time):
|
||||
def request_appointment():
|
||||
"""
|
||||
Handles a client's request for an appointment.
|
||||
Provides a link for scheduling an appointment.
|
||||
"""
|
||||
print(f"[{chat_id}] Requesting appointment for {requested_time}...")
|
||||
# TODO: Implement appointment request logic
|
||||
return "Your appointment request has been received."
|
||||
# TODO: Integrate with a real scheduling service or n8n workflow
|
||||
response_text = (
|
||||
"Para agendar una cita, por favor utiliza el siguiente enlace: \n\n"
|
||||
"[Enlace de Calendly](https://calendly.com/user/appointment-link)"
|
||||
)
|
||||
return response_text
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
# app/modules/equipo.py
|
||||
|
||||
def request_activity(chat_id, activity_details):
|
||||
def propose_activity():
|
||||
"""
|
||||
Handles a team member's request for an activity.
|
||||
Handles a team member's request to propose an activity.
|
||||
"""
|
||||
print(f"[{chat_id}] Requesting activity: {activity_details}")
|
||||
# TODO: Implement team activity request logic
|
||||
return "Your activity request has been sent for approval."
|
||||
# TODO: Implement the full workflow for proposing an activity
|
||||
return "Estás a punto de proponer una actividad. Por favor, describe la actividad, su duración y el objetivo."
|
||||
|
||||
def view_requests_status():
|
||||
"""
|
||||
Allows a team member to see the status of their requests.
|
||||
"""
|
||||
# TODO: Fetch the status of recent requests
|
||||
return "Aquí está el estado de tus solicitudes recientes:\n\n- Grabación de proyecto (4h): Aprobado\n- Taller de guion (2h): Pendiente"
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
# app/modules/servicios.py
|
||||
|
||||
def get_service_info(service_name):
|
||||
def get_service_info():
|
||||
"""
|
||||
Provides information about a service.
|
||||
Provides information about available services.
|
||||
"""
|
||||
print(f"Fetching info for service: {service_name}")
|
||||
# TODO: Implement service information logic
|
||||
return f"Here is information about {service_name}."
|
||||
|
||||
def request_quote(project_details):
|
||||
"""
|
||||
Requests a quote for a project.
|
||||
"""
|
||||
print(f"Requesting quote for: {project_details}")
|
||||
# TODO: Implement quote request logic
|
||||
return "Your quote request has been received."
|
||||
# TODO: Fetch service details from a database or config file
|
||||
return "Ofrecemos una variedad de servicios, incluyendo:\n\n- Consultoría Estratégica\n- Desarrollo de Software\n- Talleres de Capacitación\n\n¿Sobre cuál te gustaría saber más?"
|
||||
|
||||
Reference in New Issue
Block a user