up
This commit is contained in:
@@ -35,7 +35,13 @@ class BotService {
|
||||
if ($this->processSpecialCommands($phoneNumber, $messageText)) {
|
||||
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']]);
|
||||
if ($lastOutgoing && $lastIncoming && strtotime($lastOutgoing['created_at']) >= strtotime($lastIncoming['created_at'])) {
|
||||
// El asesor ya respondió, no enviar respuestas automáticas
|
||||
return;
|
||||
}
|
||||
// Verificar si el usuario está en un menú
|
||||
if ($user['current_menu_id']) {
|
||||
$this->processMenuSelection($user, $messageText);
|
||||
@@ -85,7 +91,7 @@ class BotService {
|
||||
$this->exitMenu($phoneNumber);
|
||||
return true;
|
||||
|
||||
case 'help':
|
||||
case 'asesor':
|
||||
case 'ayuda':
|
||||
$this->showHelp($phoneNumber);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user