Spaces:
Running
Running
http://162.220.13.50:3369/stats - Follow Up Deployment
Browse files- index.html +24 -19
index.html
CHANGED
|
@@ -421,25 +421,30 @@
|
|
| 421 |
menu.classList.toggle('hidden');
|
| 422 |
});
|
| 423 |
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
|
| 444 |
// Animated counters
|
| 445 |
function animateCounter(elementId, target, duration = 2000) {
|
|
|
|
| 421 |
menu.classList.toggle('hidden');
|
| 422 |
});
|
| 423 |
|
| 424 |
+
async function fetchBotStats() {
|
| 425 |
+
try {
|
| 426 |
+
const response = await fetch('http://162.220.13.50:3369/stats');
|
| 427 |
+
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
| 428 |
+
|
| 429 |
+
const data = await response.json();
|
| 430 |
+
console.log('Fetched stats:', data);
|
| 431 |
+
|
| 432 |
+
if (document.getElementById('servers-count')) animateCounter('servers-count', data.guilds);
|
| 433 |
+
if (document.getElementById('users-count')) animateCounter('users-count', data.users);
|
| 434 |
+
if (document.getElementById('commands-count')) animateCounter('commands-count', data.commands);
|
| 435 |
+
|
| 436 |
+
} catch (error) {
|
| 437 |
+
console.error('Error fetching bot stats:', error);
|
| 438 |
+
// You can enable fallback values if you want:
|
| 439 |
+
// animateCounter('servers-count', 12500);
|
| 440 |
+
// animateCounter('users-count', 850000);
|
| 441 |
+
// animateCounter('commands-count', 145);
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
// Call it once when the script loads
|
| 446 |
+
fetchBotStats();
|
| 447 |
+
|
| 448 |
|
| 449 |
// Animated counters
|
| 450 |
function animateCounter(elementId, target, duration = 2000) {
|