mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
feat: Implement interactive Vikunja task management
This commit introduces a `ConversationHandler` for the `/vik` command, replacing the previous simple command. The new implementation provides an interactive menu for users with admin permissions to: - View their tasks from a hardcoded project (ID 1). - Add new tasks to the same project. The changes include: - A new `ConversationHandler` in `app/modules/vikunja.py` to manage the interactive flow. - Integration of the new handler in `app/main.py`. - Removal of the old `/vik` command handler. - A fix in `test_vikunja.py` to correctly load environment variables.
This commit is contained in:
12
app/main.py
12
app/main.py
@@ -33,7 +33,7 @@ from modules.servicios import get_service_info
|
||||
from modules.admin import get_system_status
|
||||
from modules.print import print_handler
|
||||
from modules.create_tag import create_tag_conv_handler, create_tag_start
|
||||
from modules.vikunja import get_tasks
|
||||
from modules.vikunja import vikunja_conv_handler
|
||||
from scheduler import schedule_daily_summary
|
||||
|
||||
# Configuramos el sistema de logs para ver mensajes de estado en la consola
|
||||
@@ -132,17 +132,9 @@ def main() -> None:
|
||||
# Registramos todos los manejadores de eventos en la aplicación
|
||||
application.add_handler(conv_handler)
|
||||
application.add_handler(create_tag_conv_handler())
|
||||
application.add_handler(vikunja_conv_handler())
|
||||
application.add_handler(CommandHandler("start", start))
|
||||
application.add_handler(CommandHandler("print", print_handler))
|
||||
|
||||
# Comando /vik restringido a administradores
|
||||
async def vik_command_handler(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
if is_admin(update.effective_chat.id):
|
||||
await update.message.reply_text(get_tasks(), parse_mode='Markdown')
|
||||
else:
|
||||
await update.message.reply_text("No tienes permiso para usar este comando.")
|
||||
|
||||
application.add_handler(CommandHandler("vik", vik_command_handler))
|
||||
application.add_handler(CallbackQueryHandler(button_dispatcher))
|
||||
|
||||
# Iniciamos el bot (se queda escuchando mensajes)
|
||||
|
||||
Reference in New Issue
Block a user