all(); $bot = new TelegramBotService(); // Inline keyboard button taps if (isset($update['callback_query'])) { $cq = $update['callback_query']; $chatId = (string) $cq['message']['chat']['id']; $bot->handleCallback($chatId, $cq['id'], $cq['data'] ?? ''); return response()->json(['ok' => true]); } // Photos (payment receipts) if (isset($update['message']['photo'])) { $chatId = (string) $update['message']['chat']['id']; $photos = $update['message']['photo']; $fileId = end($photos)['file_id']; $bot->handlePhoto($chatId, $fileId); return response()->json(['ok' => true]); } // Text messages if (isset($update['message']['text'])) { $chatId = (string) $update['message']['chat']['id']; $text = $update['message']['text']; $nombre = trim( ($update['message']['from']['first_name'] ?? '') . ' ' . ($update['message']['from']['last_name'] ?? '') ); $bot->handleText($chatId, $text, $nombre); return response()->json(['ok' => true]); } return response()->json(['ok' => true]); } }