UP
This commit is contained in:
+18
-1
@@ -38,6 +38,23 @@ class BotService {
|
||||
$this->sendWelcomeMessage($phoneNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
// Si el usuario escribe 'enviado' o 'enviados' en cualquier momento, enviar confirmación de recepción
|
||||
try {
|
||||
// Support masculino/femenino, singular/plural: enviado, enviada, enviados, enviadas
|
||||
if (preg_match('/\b(enviad[oa]s?)\b/iu', $messageText)) {
|
||||
$ack = "Estaremos procesando su solicitud y confirmaremos en unos minutos";
|
||||
try {
|
||||
$this->whatsappService->sendTextMessage($phoneNumber, $ack);
|
||||
} catch (Exception $e) {
|
||||
// ignore send errors
|
||||
}
|
||||
error_log("[BotService] processMessage - sent 'enviados' ack to user {$user['id']}");
|
||||
return;
|
||||
}
|
||||
} catch (Throwable $t) {
|
||||
// ignore regex errors
|
||||
}
|
||||
|
||||
// Procesar comandos especiales
|
||||
if ($this->processSpecialCommands($phoneNumber, $messageText)) {
|
||||
@@ -470,7 +487,7 @@ class BotService {
|
||||
$pausedUntil = date('Y-m-d H:i:s', strtotime("+{$minutes} minutes"));
|
||||
// No ponemos on_hold para evitar bloqueo automático; usamos advisor_requested
|
||||
$this->db->update('users', ['advisor_requested' => 1, 'bot_paused_until' => $pausedUntil], 'phone_number = :phone', ['phone' => $phoneNumber]);
|
||||
$this->whatsappService->sendTextMessage($phoneNumber, "🔔 Te hemos transferido con un asesor, te responderemos en breve. Si no hay respuesta, podrás volver a usar *menu* después de {$minutes} minutos.");
|
||||
$this->whatsappService->sendTextMessage($phoneNumber, "🔔 Te hemos transferido con un asesor, te responderemos en breve.");
|
||||
if (function_exists('writeLog')) writeLog('INFO', "Advisor solicited for $phoneNumber until $pausedUntil");
|
||||
} catch (Exception $e) {
|
||||
error_log('requestAdvisor failed: ' . $e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user