Saltar selección de monto si el cliente lo incluye en el mensaje de recarga
Tanto en Telegram como en el chat web, cuando el usuario escribe el monto directamente (ej: "recargar 10.000"), el bot ahora va directo al paso de método de pago sin volver a preguntar el monto. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6bd0045826
commit
932a9b43c7
@@ -1438,11 +1438,20 @@ class TelegramBotService
|
||||
|
||||
$texto = $state['data']['last_text'] ?? '';
|
||||
|
||||
// Detección rápida para intents genéricos sin parámetros
|
||||
// Detección rápida para intents genéricos; extrae monto si viene en el texto
|
||||
if ($texto) {
|
||||
$accionLocal = $this->detectarPorKeywords($texto);
|
||||
if ($accionLocal) {
|
||||
$this->dispatchAction($chatId, $accionLocal, $state);
|
||||
$accionData = [];
|
||||
if ($accionLocal === 'recarga.iniciar') {
|
||||
if (preg_match('/\$?\s*(\d{1,3}(?:[.,]\d{3})+|\d{4,})\b/', $texto, $m)) {
|
||||
$monto = (int) preg_replace('/[.,]/', '', $m[1]);
|
||||
if ($monto >= 1000) {
|
||||
$accionData['monto'] = $monto;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->dispatchAction($chatId, $accionLocal, $state, $accionData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user