66 lines
2.2 KiB
Python
66 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test Discord connectivity without the full application
|
|
"""
|
|
|
|
import asyncio
|
|
import aiohttp
|
|
import socket
|
|
|
|
async def test_discord_connectivity():
|
|
"""Test various Discord endpoints to diagnose connectivity issues."""
|
|
|
|
endpoints = [
|
|
"https://discord.com",
|
|
"https://discordapp.com",
|
|
"https://gateway.discord.gg",
|
|
"https://cdn.discordapp.com"
|
|
]
|
|
|
|
# Test basic socket connection first
|
|
print("🔍 Testing socket connection to discord.com:443...")
|
|
try:
|
|
sock = socket.create_connection(("discord.com", 443), timeout=10)
|
|
sock.close()
|
|
print("✅ Socket connection successful")
|
|
except Exception as e:
|
|
print(f"❌ Socket connection failed: {e}")
|
|
return False
|
|
|
|
# Test HTTP connections
|
|
print("\n🔍 Testing HTTPS endpoints...")
|
|
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10)) as session:
|
|
for endpoint in endpoints:
|
|
try:
|
|
async with session.get(endpoint) as response:
|
|
print(f"✅ {endpoint}: {response.status}")
|
|
except Exception as e:
|
|
print(f"❌ {endpoint}: {e}")
|
|
|
|
print("\n🔍 Testing Discord API directly...")
|
|
try:
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.get("https://discord.com/api/v10/gateway") as response:
|
|
if response.status == 200:
|
|
data = await response.json()
|
|
print(f"✅ Discord API: {data.get('url', 'No gateway URL')}")
|
|
return True
|
|
else:
|
|
print(f"❌ Discord API: HTTP {response.status}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ Discord API: {e}")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
result = asyncio.run(test_discord_connectivity())
|
|
if result:
|
|
print("\n🎉 Discord connectivity looks good!")
|
|
else:
|
|
print("\n💡 Possible solutions:")
|
|
print("1. Check firewall settings")
|
|
print("2. Try different DNS (1.1.1.1 or 8.8.8.8)")
|
|
print("3. Disable VPN if active")
|
|
print("4. Check corporate proxy settings")
|
|
print("5. Try from a different network")
|