From 490f55bfcfcf609abf8d77f97063305a47d0141b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 23:31:39 +0000 Subject: [PATCH] feat: Add /print command for authorized users This commit introduces a new `/print` command that is restricted to authorized users. The main changes are: - Created `app/modules/print.py` to house the handler for the new command. - The handler uses the existing `is_admin` function from `app/permissions.py` to check for authorization. - Integrated the new command into `app/main.py`. - Updated `tasks.md` to document the new feature. --- app/main.py | 2 ++ app/modules/print.py | 13 +++++++++++++ tasks.md | 5 +++++ 3 files changed, 20 insertions(+) create mode 100644 app/modules/print.py diff --git a/app/main.py b/app/main.py index 06b31ff..fed794a 100644 --- a/app/main.py +++ b/app/main.py @@ -28,6 +28,7 @@ from modules.equipo import ( from modules.aprobaciones import view_pending, handle_approval_action from modules.servicios import get_service_info from modules.admin import get_system_status +from modules.print import print_handler # Enable logging logging.basicConfig( @@ -101,6 +102,7 @@ def main() -> None: application.add_handler(conv_handler) application.add_handler(CommandHandler("start", start)) + application.add_handler(CommandHandler("print", print_handler)) application.add_handler(CallbackQueryHandler(button_dispatcher)) logger.info("Starting Talía Bot...") diff --git a/app/modules/print.py b/app/modules/print.py new file mode 100644 index 0000000..2a97ee3 --- /dev/null +++ b/app/modules/print.py @@ -0,0 +1,13 @@ +# app/modules/print.py + +from telegram import Update +from telegram.ext import ContextTypes +from app.permissions import is_admin + +async def print_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: + """Handles the /print command.""" + chat_id = update.effective_chat.id + if is_admin(chat_id): + await update.message.reply_text("This is a restricted command for authorized users.") + else: + await update.message.reply_text("You are not authorized to use this command.") diff --git a/tasks.md b/tasks.md index 0dbd977..9ee5054 100644 --- a/tasks.md +++ b/tasks.md @@ -26,6 +26,7 @@ This file tracks the development tasks for the Talía project. - [x] Implement `aprobaciones.py` module. - [x] Implement `servicios.py` module. - [x] Implement `admin.py` module. +- [x] Add `/print` command for authorized users. ## Phase 4: Integrations @@ -43,3 +44,7 @@ This file tracks the development tasks for the Talía project. - Implemented the `agenda` and `citas` modules. - Implemented the conversational flow for proposing and approving activities. - Completed Phase 3 by implementing all modules and refactoring the main dispatcher. + +### 2024-05-23 + +- Add `/print` command for authorized users.