Actualizar server.js
This commit is contained in:
@@ -3760,14 +3760,14 @@ setInterval(async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- 2. 🚨 NUEVO: CAZADOR DE URGENCIAS QUE "ENTRAN SOLAS" 🚨 ---
|
// --- 2. 🚨 CAZADOR DE URGENCIAS (AHORA IGNORA ARCHIVADOS) 🚨 ---
|
||||||
// Buscamos servicios que sean urgentes y que sigan atascados en 'manual' o 'pending'
|
|
||||||
const pendingUrgent = await client.query(`
|
const pendingUrgent = await client.query(`
|
||||||
SELECT s.id, s.owner_id, s.raw_data, s.provider, s.service_ref, pc.auto_dispatch
|
SELECT s.id, s.owner_id, s.raw_data, s.provider, s.service_ref, pc.auto_dispatch
|
||||||
FROM scraped_services s
|
FROM scraped_services s
|
||||||
LEFT JOIN provider_credentials pc ON s.owner_id = pc.owner_id AND s.provider = pc.provider
|
LEFT JOIN provider_credentials pc ON s.owner_id = pc.owner_id AND s.provider = pc.provider
|
||||||
WHERE s.is_urgent = true
|
WHERE s.is_urgent = true
|
||||||
AND s.automation_status IN ('manual', 'pending')
|
AND s.automation_status IN ('manual', 'pending')
|
||||||
|
AND s.status != 'archived' -- 👈 AQUÍ ESTÁ EL ESCUDO ANTI-ARCHIVADOS
|
||||||
`);
|
`);
|
||||||
|
|
||||||
for (const svc of pendingUrgent.rows) {
|
for (const svc of pendingUrgent.rows) {
|
||||||
@@ -3785,7 +3785,7 @@ setInterval(async () => {
|
|||||||
const cpMatch = todoElTexto.match(/\b\d{5}\b/);
|
const cpMatch = todoElTexto.match(/\b\d{5}\b/);
|
||||||
const cpFinal = cpMatch ? cpMatch[0] : "00000";
|
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);
|
await dispatchToBolsa(svc.id, finalGuildId, cpFinal, svc.owner_id, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user