mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
This commit implements the first phase of the new architectural vision for the Talia Bot.
Key changes include:
- Renamed the main application directory from `app` to `talia_bot` and updated all associated imports and configurations (`Dockerfile`, tests).
- Replaced the static, `.env`-based permission system with a dynamic, database-driven role management system.
- Introduced a `db.py` module to manage a SQLite database (`users.db`) for user persistence.
- Updated `identity.py` to fetch roles ('admin', 'crew', 'client') from the database.
- Rewrote the `README.md` and `.env.example` to align with the new project specification.
- Refactored the LLM module into the new `modules` structure.
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
# talia_bot/modules/debug.py
|
|
# Este módulo permite a los administradores imprimir los detalles de configuración del bot.
|
|
# Es una herramienta útil para depuración (debugging).
|
|
|
|
from telegram import Update
|
|
from telegram.ext import ContextTypes
|
|
from talia_bot.modules.identity import is_admin
|
|
from talia_bot.config import TIMEZONE, CALENDAR_ID, N8N_WEBHOOK_URL
|
|
|
|
async def print_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
"""
|
|
Maneja el comando /print.
|
|
|
|
Verifica si el usuario es administrador. Si lo es, muestra valores clave
|
|
de la configuración (Zona horaria, ID de calendario, Webhook).
|
|
"""
|
|
chat_id = update.effective_chat.id
|
|
|
|
# Solo permitimos esto a los administradores
|
|
if is_admin(chat_id):
|
|
config_details = (
|
|
f"**Detalles de Configuración**\n"
|
|
f"Zona Horaria: `{TIMEZONE}`\n"
|
|
f"ID de Calendario: `{CALENDAR_ID}`\n"
|
|
f"URL Webhook n8n: `{N8N_WEBHOOK_URL}`\n"
|
|
)
|
|
await update.message.reply_text(config_details, parse_mode='Markdown')
|
|
else:
|
|
# Si no es admin, le avisamos que no tiene permiso
|
|
await update.message.reply_text("No tienes autorización para usar este comando.")
|