Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -1478,22 +1478,9 @@ async function initialize() {
|
|
| 1478 |
|
| 1479 |
retryCount++;
|
| 1480 |
try {
|
| 1481 |
-
console.log(`[*] Pre-validating token on canary.discord.com...`);
|
| 1482 |
-
const testRes = await fetch('https://canary.discord.com/api/v10/users/@me', {
|
| 1483 |
-
headers: { Authorization: `Bot ${TOKEN}` }
|
| 1484 |
-
}).catch(() => null);
|
| 1485 |
-
|
| 1486 |
-
if (testRes && testRes.status === 401) {
|
| 1487 |
-
console.error("[CRITICAL] The provided BOT_TOKEN is INVALID (Discord returned 401). Please check your HF Secrets!");
|
| 1488 |
-
return;
|
| 1489 |
-
} else if (testRes && testRes.ok) {
|
| 1490 |
-
console.log("[*] Token is VALID. Proceeding to WebSocket handshake...");
|
| 1491 |
-
} else {
|
| 1492 |
-
console.log("[*] Pre-validation skipped (network lag). Proceeding...");
|
| 1493 |
-
}
|
| 1494 |
-
|
| 1495 |
console.log(`[*] Attempting connection to Discord (Attempt ${retryCount}) on discord.com...`);
|
| 1496 |
|
|
|
|
| 1497 |
|
| 1498 |
// Destroy any stale connection before retrying
|
| 1499 |
if (retryCount > 1) {
|
|
|
|
| 1478 |
|
| 1479 |
retryCount++;
|
| 1480 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1481 |
console.log(`[*] Attempting connection to Discord (Attempt ${retryCount}) on discord.com...`);
|
| 1482 |
|
| 1483 |
+
|
| 1484 |
|
| 1485 |
// Destroy any stale connection before retrying
|
| 1486 |
if (retryCount > 1) {
|