This commit is contained in:
lizandrogd
2026-01-21 15:08:18 -05:00
parent 659886c2d3
commit 75b8f469f4
3 changed files with 66 additions and 36 deletions
+8
View File
@@ -541,6 +541,14 @@ class WhatsAppService
}
$this->db->insert('conversations', $messageData);
// Si un asesor envía un mensaje, limpiar la solicitud de asesor (advisor_requested)
try {
$this->db->update('users', ['advisor_requested' => 0, 'on_hold' => 0, 'bot_paused_until' => null], 'id = :id', ['id' => $user['id']]);
if (function_exists('writeLog')) writeLog('INFO', "Cleared advisor_requested for user {$user['id']} after outgoing message");
} catch (Exception $e) {
error_log('Failed to clear advisor_requested after outgoing: ' . $e->getMessage());
}
}
} catch (Exception $e) {
error_log("Error saving outgoing message: " . $e->getMessage());