Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -31,7 +31,7 @@ const client = new Client({
|
|
| 31 |
],
|
| 32 |
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
|
| 33 |
rest: {
|
| 34 |
-
api:
|
| 35 |
version: '10',
|
| 36 |
timeout: 60000
|
| 37 |
},
|
|
@@ -1345,11 +1345,6 @@ setInterval(async () => {
|
|
| 1345 |
console.log("[*] Performing emergency network rotation and restart...");
|
| 1346 |
networkFix.rotateEndpoint();
|
| 1347 |
|
| 1348 |
-
// Re-sync REST API just in case
|
| 1349 |
-
if (client.rest) {
|
| 1350 |
-
client.rest.options.api = `https://${networkFix.getTargetDomain()}/api`;
|
| 1351 |
-
}
|
| 1352 |
-
|
| 1353 |
// Attempt to keep session alive or force a new login if really dead
|
| 1354 |
if (client.ws.status === 7 || client.ws.status === 9) { // DISCONNECTED or INVALID_SESSION
|
| 1355 |
process.exit(1); // Force a full container restart by PM2/HuggingFace
|
|
@@ -1426,9 +1421,6 @@ async function initialize() {
|
|
| 1426 |
|
| 1427 |
// Professional Failover: Rotate endpoint and try again
|
| 1428 |
networkFix.rotateEndpoint();
|
| 1429 |
-
if (client.rest) {
|
| 1430 |
-
client.rest.options.api = `https://${networkFix.getTargetDomain()}/api`;
|
| 1431 |
-
}
|
| 1432 |
|
| 1433 |
// Exponential backoff for retries
|
| 1434 |
retryCount++;
|
|
|
|
| 31 |
],
|
| 32 |
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
|
| 33 |
rest: {
|
| 34 |
+
api: 'https://discord.com/api',
|
| 35 |
version: '10',
|
| 36 |
timeout: 60000
|
| 37 |
},
|
|
|
|
| 1345 |
console.log("[*] Performing emergency network rotation and restart...");
|
| 1346 |
networkFix.rotateEndpoint();
|
| 1347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1348 |
// Attempt to keep session alive or force a new login if really dead
|
| 1349 |
if (client.ws.status === 7 || client.ws.status === 9) { // DISCONNECTED or INVALID_SESSION
|
| 1350 |
process.exit(1); // Force a full container restart by PM2/HuggingFace
|
|
|
|
| 1421 |
|
| 1422 |
// Professional Failover: Rotate endpoint and try again
|
| 1423 |
networkFix.rotateEndpoint();
|
|
|
|
|
|
|
|
|
|
| 1424 |
|
| 1425 |
// Exponential backoff for retries
|
| 1426 |
retryCount++;
|