Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -1450,7 +1450,7 @@ async function initialize() {
|
|
| 1450 |
server.startServer(client, commandsData);
|
| 1451 |
|
| 1452 |
let retryCount = 0;
|
| 1453 |
-
const
|
| 1454 |
|
| 1455 |
async function login() {
|
| 1456 |
if (!TOKEN || TOKEN.length < 10) {
|
|
@@ -1461,8 +1461,8 @@ async function initialize() {
|
|
| 1461 |
}
|
| 1462 |
|
| 1463 |
try {
|
| 1464 |
-
console.log(`[*] Attempting connection to Discord (Attempt ${retryCount + 1})...`);
|
| 1465 |
await client.login(TOKEN);
|
|
|
|
| 1466 |
} catch (err) {
|
| 1467 |
console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
|
| 1468 |
|
|
@@ -1484,12 +1484,9 @@ async function initialize() {
|
|
| 1484 |
networkFix.rotateEndpoint();
|
| 1485 |
}
|
| 1486 |
|
| 1487 |
-
//
|
| 1488 |
retryCount++;
|
| 1489 |
-
|
| 1490 |
-
|
| 1491 |
-
console.log(`[*] Retrying in ${delay / 1000}s...`);
|
| 1492 |
-
setTimeout(login, delay);
|
| 1493 |
}
|
| 1494 |
}
|
| 1495 |
|
|
|
|
| 1450 |
server.startServer(client, commandsData);
|
| 1451 |
|
| 1452 |
let retryCount = 0;
|
| 1453 |
+
const retryDelayMs = 1000; // aggressive 1s retries
|
| 1454 |
|
| 1455 |
async function login() {
|
| 1456 |
if (!TOKEN || TOKEN.length < 10) {
|
|
|
|
| 1461 |
}
|
| 1462 |
|
| 1463 |
try {
|
|
|
|
| 1464 |
await client.login(TOKEN);
|
| 1465 |
+
retryCount = 0;
|
| 1466 |
} catch (err) {
|
| 1467 |
console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
|
| 1468 |
|
|
|
|
| 1484 |
networkFix.rotateEndpoint();
|
| 1485 |
}
|
| 1486 |
|
| 1487 |
+
// Keep retries immediate for fastest reconnect behavior.
|
| 1488 |
retryCount++;
|
| 1489 |
+
setTimeout(login, retryDelayMs);
|
|
|
|
|
|
|
|
|
|
| 1490 |
}
|
| 1491 |
}
|
| 1492 |
|