mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
feat: Add /print command for authorized users
This commit introduces a new `/print` command that is restricted to authorized users. The command displays non-sensitive configuration details to administrators. 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. - The command displays the Timezone, Calendar ID, and n8n Webhook URL. - Integrated the new command into `app/main.py`. - Updated `tasks.md` to document the new feature.
This commit is contained in:
@@ -2,12 +2,19 @@
|
||||
|
||||
from telegram import Update
|
||||
from telegram.ext import ContextTypes
|
||||
from app.permissions import is_admin
|
||||
from ..permissions import is_admin
|
||||
from ..config import TIMEZONE, CALENDAR_ID, N8N_WEBHOOK_URL
|
||||
|
||||
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.")
|
||||
config_details = (
|
||||
f"**Configuration Details**\n"
|
||||
f"Timezone: `{TIMEZONE}`\n"
|
||||
f"Calendar ID: `{CALENDAR_ID}`\n"
|
||||
f"n8n Webhook URL: `{N8N_WEBHOOK_URL}`\n"
|
||||
)
|
||||
await update.message.reply_text(config_details, parse_mode='Markdown')
|
||||
else:
|
||||
await update.message.reply_text("You are not authorized to use this command.")
|
||||
|
||||
Reference in New Issue
Block a user