Actualizar server.js

This commit is contained in:
2026-03-15 17:44:21 +00:00
parent 78f5f909bc
commit 60a4b7815c

View File

@@ -3760,14 +3760,14 @@ setInterval(async () => {
}
}
// --- 2. 🚨 NUEVO: CAZADOR DE URGENCIAS QUE "ENTRAN SOLAS" 🚨 ---
// Buscamos servicios que sean urgentes y que sigan atascados en 'manual' o 'pending'
// --- 2. 🚨 CAZADOR DE URGENCIAS (AHORA IGNORA ARCHIVADOS) 🚨 ---
const pendingUrgent = await client.query(`
SELECT s.id, s.owner_id, s.raw_data, s.provider, s.service_ref, pc.auto_dispatch
FROM scraped_services s
LEFT JOIN provider_credentials pc ON s.owner_id = pc.owner_id AND s.provider = pc.provider
WHERE s.is_urgent = true
AND s.automation_status IN ('manual', 'pending')
AND s.status != 'archived' -- 👈 AQUÍ ESTÁ EL ESCUDO ANTI-ARCHIVADOS
`);
for (const svc of pendingUrgent.rows) {
@@ -3785,7 +3785,7 @@ setInterval(async () => {
const cpMatch = todoElTexto.match(/\b\d{5}\b/);
const cpFinal = cpMatch ? cpMatch[0] : "00000";
// 🔥 Disparamos la función mágica que reparte los WhatsApps
// 🔥 Disparamos la bolsa
await dispatchToBolsa(svc.id, finalGuildId, cpFinal, svc.owner_id, null);
}
}