fix: sendWelcomeMessage no envía si términos no han sido aceptados
This commit is contained in:
@@ -698,6 +698,16 @@ class BotService {
|
||||
* Enviar mensaje de bienvenida
|
||||
*/
|
||||
public function sendWelcomeMessage($phoneNumber) {
|
||||
// No enviar bienvenida si hay términos activos y el usuario aún no los ha aceptado
|
||||
$termsVersion = $this->getActiveTermsVersion();
|
||||
if ($termsVersion) {
|
||||
$userRow = $this->db->fetch("SELECT terms_accepted_at FROM users WHERE phone_number = :phone", ['phone' => $phoneNumber]);
|
||||
if (empty($userRow['terms_accepted_at'])) {
|
||||
error_log("[BotService] sendWelcomeMessage - skipped for {$phoneNumber}: terms not accepted yet");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$enabled = getConfigFromDB('welcome_enabled', '1');
|
||||
$welcomeMessage = getConfigFromDB('welcome_message', '¡Hola! 👋 Bienvenido a nuestro servicio automatizado. Escriba *MENU* para ver las opciones disponibles.');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user