up
This commit is contained in:
@@ -51,6 +51,11 @@ class BotService {
|
||||
return;
|
||||
}
|
||||
|
||||
// Si el usuario ha desactivado el bot manualmente (toggle), no responder
|
||||
if (isset($user['bot_enabled']) && !$user['bot_enabled']) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Si el asesor ya respondió después del último mensaje del usuario, frenar al bot
|
||||
$lastIncoming = $this->db->fetch("SELECT created_at FROM conversations WHERE user_id = :uid AND direction = 'incoming' ORDER BY created_at DESC LIMIT 1", ['uid' => $user['id']]);
|
||||
$lastOutgoing = $this->db->fetch("SELECT created_at FROM conversations WHERE user_id = :uid AND direction = 'outgoing' ORDER BY created_at DESC LIMIT 1", ['uid' => $user['id']]);
|
||||
|
||||
Reference in New Issue
Block a user