mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
refactor: Migrate bot core and modules from talia_bot to bot directory, update start_bot.sh and Dockerfile, and modify README.md.
This commit is contained in:
36
bot/modules/debug.py
Normal file
36
bot/modules/debug.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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 bot.modules.identity import is_admin
|
||||
from bot.config import (
|
||||
TIMEZONE,
|
||||
WORK_GOOGLE_CALENDAR_ID,
|
||||
PERSONAL_GOOGLE_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"Calendario Trabajo: `{WORK_GOOGLE_CALENDAR_ID or 'No definido'}`\n"
|
||||
f"Calendario Personal: `{PERSONAL_GOOGLE_CALENDAR_ID or 'No definido'}`\n"
|
||||
f"URL Webhook n8n: `{N8N_WEBHOOK_URL or 'No definido'}`\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.")
|
||||
Reference in New Issue
Block a user