Diagnóstico de puruto-telegram
This content is not available in your language yet.
Qué cubre esta página
- Flujo de diagnóstico de
puruto-telegram - Checks de
.env, token,.channels.json, DB e inbox - Pruebas de
inbox.py(--limit,--deliver) - Limitaciones del router/invocación en el scaffold MVP
Alcance
Fuente de verdad:
- templates
telegram/*.py.tpldel generador - skills scaffold
init,status,drain-inbox,add-channel
Principio de diagnóstico
Separa siempre estos problemas:
- Configuración del bot (token/chat/env)
- Catálogo de canales (
.channels.json) - Estado local del bot (DB
db/telegram.db) - Inbox local de
puruto-cron(inbox/cron-events.jsonl) - Enrutamiento a Purutos (MVP placeholder en
router.py)
Paso 1. Validar estructura del repo
python3 /Users/pepetox/Documents/01-code/puruto/.claude/skills/validate/scripts/validate.py /ruta/a/puruto-telegram --jsonRevisa:
kind = "puruto-telegram"errors = 0
Paso 2. Checks base del scaffold (init)
La skill /init del scaffold sugiere este flujo:
- verificar
.envy token - instalar dependencias
- inicializar DB
- inicializar
.channels.json - preparar
inbox/ - verificar conectividad con Telegram
Paso 3. Verificar token y chat por defecto
Variables clave:
PURUTO_TELEGRAM_BOT_TOKENPURUTO_TELEGRAM_DEFAULT_CHAT_ID(parainbox.py --deliver)
Comprobación rápida:
python3 - <<'PY'import osfrom dotenv import load_dotenvload_dotenv()print("TOKEN:", "OK" if os.getenv("PURUTO_TELEGRAM_BOT_TOKEN") else "FALTA")print("DEFAULT_CHAT_ID:", "OK" if os.getenv("PURUTO_TELEGRAM_DEFAULT_CHAT_ID") else "no configurado")PYPaso 4. Verificar .channels.json
Comprobación rápida:
python3 - <<'PY'import jsonfrom pathlib import Path
p = Path(".channels.json")data = json.loads(p.read_text(encoding="utf-8")) if p.exists() else {"channels": []}print("channels:", data.get("channels", []))PYReferencia:
Paso 5. Verificar DB local e inbox
Comprobaciones:
ls -la db inboxpython3 inbox.py --limit 20inbox.py devuelve JSON con:
processedoffsetinbox_fileforwarded_logpreview
Paso 6. Verificar estado con la skill status
La skill scaffold /status revisa:
- token
- chat por defecto
- canales registrados
- DB (
db/telegram.db) - eventos en
inbox/cron-events.jsonl
Puedes reproducirlo con:
python3 -c "import os, jsonfrom pathlib import Pathfrom dotenv import load_dotenvload_dotenv()
token = os.getenv('PURUTO_TELEGRAM_BOT_TOKEN', '')chat_id = os.getenv('PURUTO_TELEGRAM_DEFAULT_CHAT_ID', '')f = Path('.channels.json')channels = json.loads(f.read_text()).get('channels', []) if f.exists() else []db = Path(os.getenv('DB_PATH', 'db/telegram.db'))inbox = Path('inbox/cron-events.jsonl')events = sum(1 for _ in inbox.open('r', encoding='utf-8')) if inbox.exists() else 0
print('── puruto-telegram status ──')print(' Token:', 'configurado' if token else 'FALTA')print(' Chat por defecto:', 'configurado' if chat_id else 'no configurado')print(f' Canales: {len(channels)} — {channels}')print(' DB:', 'OK' if db.exists() else 'no inicializada — ejecuta init')print(f' Inbox cron: {events} eventos en {inbox}')"Paso 7. Probar --deliver (opcional)
Comando:
python3 inbox.py --deliverRequiere:
PURUTO_TELEGRAM_BOT_TOKENPURUTO_TELEGRAM_DEFAULT_CHAT_ID
Si no están configuradas, inbox.py no falla duro: registra _delivery.status = "skipped" en el flujo de envío y cuenta skipped_delivery.
Diagnóstico por síntomas
El canal no aparece tras /add-channel
Revisa:
../<canal>existe (la skill lo valida).channels.jsoncontiene el canal- reiniciaste
python3 bot.py(necesario para cargar nuevosCommandHandler)
inbox.py --deliver no envía nada
Revisa:
PURUTO_TELEGRAM_DEFAULT_CHAT_ID- token válido
inbox/cron-events.jsonlcon eventos
El bot responde pero no “habla” con el Puruto real
Limitación actual del scaffold:
router.pydevuelve un placeholder (enrutamiento real pendiente de implementar) en lugar de invocar un runtime real del Puruto
Checklist de diagnóstico rápido
validate.pydel repopuruto-telegram✅.channels.jsonparsea ✅db/telegram.dbexiste ✅inbox.py --limit 20responde ✅PURUTO_TELEGRAM_BOT_TOKENconfigurado ✅python3 bot.pyarranca ✅
Referencias relacionadas
Última verificación
Runbook contrastado con telegram/bot.py.tpl, telegram/inbox.py.tpl, telegram/db.py.tpl, telegram/router.py.tpl y skills scaffold de puruto-telegram el 25 de febrero de 2026.