'Verificar token configurado', 'success' => !empty($bot_token), 'message' => !empty($bot_token) ? 'Token configurado correctamente' : 'Token no configurado' ]; // Test 2: Obtener información del bot if (!empty($bot_token)) { $ch = curl_init('https://discord.com/api/v10/users/@me'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bot ' . $bot_token, 'Content-Type: application/json' ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $success = $httpCode === 200; $allSuccess = $allSuccess && $success; if ($success) { $botInfo = json_decode($response, true); $testResults[] = [ 'test' => 'Conectar con Discord API', 'success' => true, 'message' => 'Conectado como: ' . $botInfo['username'] . '#' . $botInfo['discriminator'], 'data' => $botInfo ]; } else { $testResults[] = [ 'test' => 'Conectar con Discord API', 'success' => false, 'message' => 'Error HTTP ' . $httpCode . ': ' . $response ]; } } // Test 3: Obtener información del servidor/guild if (!empty($bot_token) && !empty($guild_id)) { $ch = curl_init("https://discord.com/api/v10/guilds/{$guild_id}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bot ' . $bot_token, 'Content-Type: application/json' ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $success = $httpCode === 200; $allSuccess = $allSuccess && $success; if ($success) { $guildInfo = json_decode($response, true); $testResults[] = [ 'test' => 'Acceder al servidor Discord', 'success' => true, 'message' => 'Servidor: ' . $guildInfo['name'] . ' (Miembros: ' . ($guildInfo['approximate_member_count'] ?? 'N/A') . ')', 'data' => $guildInfo ]; } else { $testResults[] = [ 'test' => 'Acceder al servidor Discord', 'success' => false, 'message' => 'Error HTTP ' . $httpCode . ': ' . $response ]; } } // Test 4: Listar canales if (!empty($bot_token) && !empty($guild_id)) { $ch = curl_init("https://discord.com/api/v10/guilds/{$guild_id}/channels"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bot ' . $bot_token, 'Content-Type: application/json' ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $success = $httpCode === 200; $allSuccess = $allSuccess && $success; if ($success) { $channels = json_decode($response, true); $textChannels = array_filter($channels, fn($c) => $c['type'] === 0); $testResults[] = [ 'test' => 'Listar canales', 'success' => true, 'message' => 'Se encontraron ' . count($textChannels) . ' canales de texto', 'data' => array_slice($textChannels, 0, 5) ]; } else { $testResults[] = [ 'test' => 'Listar canales', 'success' => false, 'message' => 'Error HTTP ' . $httpCode ]; } } ?> Test Discord - Sistema de Bots

🧪 Test de Conexión con Discord

✅ Todos los tests pasaron correctamente ❌ Algunos tests fallaron
← Volver al Dashboard