The role of social attraction and social avoidance in shaping modular networks