Commit III
This commit is contained in:
parent
abc369bd04
commit
163d58d871
5 changed files with 9 additions and 12 deletions
2
.env
2
.env
|
|
@ -17,4 +17,4 @@ OPENWA_API_KEY=owa_k1_f3e283de607aabd68462cd449c980ab18c4f1c6286bdeea3f5e64fd863
|
|||
|
||||
# Configuración del worker
|
||||
WORKER_INTERVAL=3000
|
||||
PORT=3001
|
||||
PORT=3002
|
||||
6
dist/worker/worker.service.js
vendored
6
dist/worker/worker.service.js
vendored
|
|
@ -120,6 +120,8 @@ let WorkerService = WorkerService_1 = class WorkerService {
|
|||
await this.actualizarEstado(idMensajeWhatsApp, 'ERROR', 'No hay sesiones OpenWA disponibles');
|
||||
return;
|
||||
}
|
||||
await this.actualizarEstado(idMensajeWhatsApp, 'ENVIANDO');
|
||||
this.logger.log(`[${this.timestamp()}] 🔄 Estado cambiado a ENVIANDO`);
|
||||
const chatId = `${telefonoDestino}@c.us`;
|
||||
const mensajes = [mensaje1, mensaje2, mensaje3].filter((m) => Boolean(m));
|
||||
if (mensajes.length > 0) {
|
||||
|
|
@ -136,10 +138,6 @@ let WorkerService = WorkerService_1 = class WorkerService {
|
|||
await this.enviarTexto(sessionId, chatId, textoConQR);
|
||||
this.logger.log(`[${this.timestamp()}] ✉️ Mensaje 1 (QR como link) enviado INMEDIATO`);
|
||||
}
|
||||
if (mensajes.length > 1) {
|
||||
await this.actualizarEstado(idMensajeWhatsApp, 'ENVIANDO');
|
||||
this.logger.log(`[${this.timestamp()}] 🔄 Estado cambiado a ENVIANDO`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
await this.enviarTexto(sessionId, chatId, texto1);
|
||||
|
|
|
|||
2
dist/worker/worker.service.js.map
vendored
2
dist/worker/worker.service.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -147,6 +147,10 @@ export class WorkerService implements OnModuleInit, OnModuleDestroy {
|
|||
return;
|
||||
}
|
||||
|
||||
// Cambiar estado a ENVIANDO ANTES de enviar para evitar duplicados
|
||||
await this.actualizarEstado(idMensajeWhatsApp, 'ENVIANDO');
|
||||
this.logger.log(`[${this.timestamp()}] 🔄 Estado cambiado a ENVIANDO`);
|
||||
|
||||
const chatId = `${telefonoDestino}@c.us`;
|
||||
const mensajes: string[] = [mensaje1, mensaje2, mensaje3].filter((m): m is string => Boolean(m));
|
||||
|
||||
|
|
@ -165,11 +169,6 @@ export class WorkerService implements OnModuleInit, OnModuleDestroy {
|
|||
await this.enviarTexto(sessionId, chatId, textoConQR);
|
||||
this.logger.log(`[${this.timestamp()}] ✉️ Mensaje 1 (QR como link) enviado INMEDIATO`);
|
||||
}
|
||||
// Cambiar estado a ENVIANDO después del primer mensaje (RECEPCION_PAQUETE tiene 3 mensajes)
|
||||
if (mensajes.length > 1) {
|
||||
await this.actualizarEstado(idMensajeWhatsApp, 'ENVIANDO');
|
||||
this.logger.log(`[${this.timestamp()}] 🔄 Estado cambiado a ENVIANDO`);
|
||||
}
|
||||
} else {
|
||||
await this.enviarTexto(sessionId, chatId, texto1);
|
||||
this.logger.log(`[${this.timestamp()}] ✉️ Mensaje 1 enviado INMEDIATO`);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue