Spaces:
Runtime error
Runtime error
Download stats.html from Brozy123/LineUp-Bot: direct link, hf CLI and curl.
- Browser
- Download file 7.55 kB
-
https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/main/stats.html
- Command line
-
hf download hf://spaces/Brozy123/LineUp-Bot/stats.html
-
curl -L -o stats.html https://huggingface.co/spaces/Brozy123/LineUp-Bot/resolve/main/stats.html
7.55 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>FriendlyBot — Advanced Stats</title> | |
| <link rel="icon" href="/logo.png" /> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" /> | |
| <style> | |
| :root { | |
| --bg: #0a0a1a; --surface: #12122a; --surface2: #1a1a3a; --border: rgba(255,255,255,0.08); | |
| --text: #fff; --text-dim: rgba(255,255,255,0.6); --gold: #FFD700; | |
| --accent: #5865F2; --radius: 16px; --red: #ED4245; | |
| } | |
| * { box-sizing: border-box; margin:0; padding:0; } | |
| body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; padding: 40px 20px; } | |
| header { max-width: 800px; margin: 0 auto 40px; display: flex; justify-content: space-between; align-items: center; } | |
| h1 { font-size: 28px; font-weight: 700; } | |
| .btn { | |
| display: inline-block; padding: 10px 20px; background: var(--accent); | |
| color: #fff; text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; border: none; cursor: pointer; | |
| } | |
| .btn-secondary { background: var(--surface2); border: 1px solid var(--border); } | |
| .container { max-width: 800px; margin: 0 auto; } | |
| .card { | |
| background: rgba(18,18,42,0.85); backdrop-filter: blur(8px); | |
| border: 1px solid var(--border); border-radius: var(--radius); | |
| padding: 32px; margin-bottom: 30px; | |
| } | |
| .card h2 { font-size: 20px; margin-bottom: 12px; } | |
| .card p { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; } | |
| .config-grid { display: grid; gap: 24px; } | |
| .input-group label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; } | |
| input, select { | |
| width: 100%; padding: 14px; background: var(--surface2); border: 1px solid var(--border); | |
| border-radius: 10px; color: #fff; font-size: 15px; outline: none; | |
| } | |
| #guild-selector { margin-bottom: 30px; } | |
| .server-select { width: 100%; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; } | |
| .save-bar { position: sticky; bottom: 20px; background: var(--surface); border: 1px solid var(--border); padding: 16px 24px; border-radius: 100px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 100; } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <div style="display:flex; align-items:center; gap:16px"> | |
| <div style="font-size:32px">📊</div> | |
| <h1>Advanced Stats</h1> | |
| </div> | |
| <div style="display:flex; gap:10px"> | |
| <a href="/premium" class="btn btn-secondary">Back to Premium</a> | |
| <a href="/dashboard" class="btn btn-secondary">Dashboard</a> | |
| </div> | |
| </header> | |
| <div class="container"> | |
| <div id="guild-selector"> | |
| <label style="display:block; font-size:13px; color:var(--text-dim); margin-bottom:10px">Select a Server to Configure</label> | |
| <select id="server-list" class="server-select" onchange="loadConfig(this.value)"> | |
| <option value="">Loading your servers...</option> | |
| </select> | |
| </div> | |
| <div class="card" id="config-card" style="display:none"> | |
| <h2>Leaderboards & Analytics</h2> | |
| <p>Configure how stats are tracked and displayed in your server.</p> | |
| <div class="config-grid"> | |
| <div class="input-group"> | |
| <label>Leaderboard Channel</label> | |
| <select id="config-leaderboard-channel" onchange="checkChanges()"> | |
| <option value="">Select a channel...</option> | |
| </select> | |
| <p style="font-size:12px; color:var(--text-dim); margin-top:8px">The bot will automatically update a leaderboard message in this channel.</p> | |
| </div> | |
| <div class="input-group"> | |
| <label>Auto-Post Stats</label> | |
| <select id="config-stats-frequency" onchange="checkChanges()"> | |
| <option value="never">Never</option> | |
| <option value="daily">Daily</option> | |
| <option value="weekly">Weekly</option> | |
| <option value="monthly">Monthly</option> | |
| </select> | |
| <p style="font-size:12px; color:var(--text-dim); margin-top:8px">How often should the bot post the top performers of the period?</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="save-bar" id="save-bar" style="display:none; max-width:800px; margin: 0 auto;"> | |
| <span style="font-size:14px; font-weight:500">You have unsaved changes!</span> | |
| <button class="btn" onclick="saveConfig()">Save Stats Settings</button> | |
| </div> | |
| <script> | |
| let currentGuildId = null; | |
| async function init() { | |
| try { | |
| const serversR = await fetch('/api/servers'); | |
| const serversData = await serversR.json(); | |
| const serverSelect = document.getElementById('server-list'); | |
| const servers = serversData.servers || []; | |
| if (servers.length === 0) { | |
| serverSelect.innerHTML = '<option value="">No manageable servers found</option>'; | |
| return; | |
| } | |
| serverSelect.innerHTML = '<option value="">-- Choose a Server --</option>' + | |
| servers.map(s => `<option value="${s.id}">${s.name}</option>`).join(''); | |
| } catch (e) { console.error(e); } | |
| } | |
| async function loadConfig(guildId) { | |
| if (!guildId) { | |
| document.getElementById('config-card').style.display = 'none'; | |
| document.getElementById('save-bar').style.display = 'none'; | |
| return; | |
| } | |
| currentGuildId = guildId; | |
| document.getElementById('config-card').style.display = 'block'; | |
| try { | |
| const [configR, channelsR] = await Promise.all([ | |
| fetch(`/api/config/${guildId}`), | |
| fetch(`/api/channels/${guildId}`) | |
| ]); | |
| const data = await configR.json(); | |
| const channels = await channelsR.json(); | |
| const channelSelect = document.getElementById('config-leaderboard-channel'); | |
| channelSelect.innerHTML = '<option value="">Select a channel...</option>' + | |
| channels.map(c => `<option value="${c.id}" ${c.id === data.leaderboardChannel ? 'selected' : ''}>#${c.name}</option>`).join(''); | |
| document.getElementById('config-stats-frequency').value = data.statsFrequency || 'never'; | |
| document.getElementById('save-bar').style.display = 'none'; | |
| } catch (e) { alert('Failed to load configuration'); } | |
| } | |
| function checkChanges() { | |
| if (!currentGuildId) return; | |
| document.getElementById('save-bar').style.display = 'flex'; | |
| } | |
| async function saveConfig() { | |
| const leaderboardChannel = document.getElementById('config-leaderboard-channel').value; | |
| const statsFrequency = document.getElementById('config-stats-frequency').value; | |
| try { | |
| const r = await fetch(`/api/config/${currentGuildId}`, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ leaderboardChannel, statsFrequency }) | |
| }); | |
| const data = await r.json(); | |
| if (data.success) { | |
| alert('✅ Stats settings saved!'); | |
| document.getElementById('save-bar').style.display = 'none'; | |
| } else { | |
| alert('❌ Error: ' + data.error); | |
| } | |
| } catch (e) { alert('❌ Failed to save'); } | |
| } | |
| init(); | |
| </script> | |
| </body> | |
| </html> | |