systemxhost commited on
Commit
29ba4d3
·
verified ·
1 Parent(s): a0d1258

http://162.220.13.50:3369/stats - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +24 -19
index.html CHANGED
@@ -421,25 +421,30 @@
421
  menu.classList.toggle('hidden');
422
  });
423
 
424
- // Fetch real bot statistics
425
- async function fetchBotStats() {
426
- try {
427
- // Replace with your actual API endpoint
428
- const response = await fetch('http://162.220.13.50:3369/stats');
429
- const data = await response.json();
430
-
431
- // Animate counters with real data
432
- animateCounter('servers-count', data.guilds);
433
- animateCounter('users-count', data.users);
434
- animateCounter('commands-count', data.commands);
435
- } catch (error) {
436
- // console.error('Error fetching bot stats:', error);
437
- // Fallback to reasonable defaults if API fails
438
- // animateCounter('servers-count', 12500);
439
- //animateCounter('users-count', 850000);
440
- //animateCounter('commands-count', 145);
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) {