Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -1430,19 +1430,9 @@ async function initialize() {
|
|
| 1430 |
|
| 1431 |
let retryCount = 0;
|
| 1432 |
const maxRetryDelay = 15000; // keep retries fast
|
| 1433 |
-
const loginAttemptTimeoutMs = 20000;
|
| 1434 |
const hardRestartAfterMs = 90000;
|
| 1435 |
const startupAt = Date.now();
|
| 1436 |
|
| 1437 |
-
function withTimeout(promise, timeoutMs) {
|
| 1438 |
-
return Promise.race([
|
| 1439 |
-
promise,
|
| 1440 |
-
new Promise((_, reject) => {
|
| 1441 |
-
setTimeout(() => reject(new Error(`Login attempt timed out after ${timeoutMs}ms`)), timeoutMs);
|
| 1442 |
-
})
|
| 1443 |
-
]);
|
| 1444 |
-
}
|
| 1445 |
-
|
| 1446 |
async function login() {
|
| 1447 |
if (!TOKEN || TOKEN.length < 10) {
|
| 1448 |
console.error("[CRITICAL] Discord Token is missing or malformed.");
|
|
@@ -1451,7 +1441,7 @@ async function initialize() {
|
|
| 1451 |
|
| 1452 |
try {
|
| 1453 |
console.log(`[*] Attempting connection to Discord (Attempt ${retryCount + 1})...`);
|
| 1454 |
-
await
|
| 1455 |
} catch (err) {
|
| 1456 |
console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
|
| 1457 |
|
|
|
|
| 1430 |
|
| 1431 |
let retryCount = 0;
|
| 1432 |
const maxRetryDelay = 15000; // keep retries fast
|
|
|
|
| 1433 |
const hardRestartAfterMs = 90000;
|
| 1434 |
const startupAt = Date.now();
|
| 1435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1436 |
async function login() {
|
| 1437 |
if (!TOKEN || TOKEN.length < 10) {
|
| 1438 |
console.error("[CRITICAL] Discord Token is missing or malformed.");
|
|
|
|
| 1441 |
|
| 1442 |
try {
|
| 1443 |
console.log(`[*] Attempting connection to Discord (Attempt ${retryCount + 1})...`);
|
| 1444 |
+
await client.login(TOKEN);
|
| 1445 |
} catch (err) {
|
| 1446 |
console.error(`[ERROR] Authentication Failed: ${err.message || 'No Description'}`);
|
| 1447 |
|