Add menu/salir commands to Telegram bot
- Any message matching salir/menu/volver/cancelar/inicio resets flow and shows main menu - Register /menu /salir /cancelar as official bot commands via setMyCommands - Commands are registered automatically when saving the webhook from admin panel Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
b0c1407f2d
commit
3f2bdc0d47
@@ -99,9 +99,15 @@ class ShowConfiguracionChat extends Component
|
||||
|
||||
$data = $response->json();
|
||||
|
||||
$this->webhookResult = ($data['ok'] ?? false)
|
||||
? '✅ Webhook registrado correctamente.'
|
||||
: '❌ Error de Telegram: ' . ($data['description'] ?? 'respuesta desconocida');
|
||||
if (! ($data['ok'] ?? false)) {
|
||||
$this->webhookResult = '❌ Error de Telegram: ' . ($data['description'] ?? 'respuesta desconocida');
|
||||
return;
|
||||
}
|
||||
|
||||
// Registrar comandos del bot (/menu, /salir, /cancelar)
|
||||
app(\App\Services\TelegramBotService::class)->registrarComandos();
|
||||
|
||||
$this->webhookResult = '✅ Webhook registrado y comandos configurados correctamente.';
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
$this->webhookResult = '❌ No se pudo conectar con Telegram: ' . $e->getMessage();
|
||||
|
||||
Reference in New Issue
Block a user