Spaces:
Runtime error
Runtime error
Update dashboard.html
Browse files- dashboard.html +46 -8
dashboard.html
CHANGED
|
@@ -654,6 +654,29 @@ input:checked + .slider:before {
|
|
| 654 |
<p style="font-size:12px; color:var(--text-dim); margin-top:16px">When enabled, the bot will automatically post a friendly match poll in the selected channel at the specified interval.</p>
|
| 655 |
</div>
|
| 656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 657 |
<div style="border-top:1px solid var(--border); padding-top:24px; text-align:right">
|
| 658 |
<button class="invite-btn" onclick="saveConfig()" style="background:var(--accent); color:white; padding:12px 32px">Save All Changes</button>
|
| 659 |
</div>
|
|
@@ -782,19 +805,30 @@ function openServerSettings(id, name) {
|
|
| 782 |
document.getElementById('config-prefix').value = data.prefix || '!';
|
| 783 |
document.getElementById('config-auto-enabled').checked = data.autoFriendlyEnabled || false;
|
| 784 |
document.getElementById('config-auto-interval').value = data.autoFriendlyInterval || 40;
|
|
|
|
| 785 |
|
| 786 |
// Load channels and set selected
|
| 787 |
fetch('/api/channels/' + id)
|
| 788 |
.then(cr => cr.json())
|
| 789 |
.then(channels => {
|
| 790 |
-
const
|
| 791 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 792 |
channels.forEach(c => {
|
| 793 |
-
const
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
if (c.id === data.autoFriendlyChannel)
|
| 797 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
});
|
| 799 |
});
|
| 800 |
});
|
|
@@ -806,6 +840,8 @@ function saveConfig() {
|
|
| 806 |
const autoFriendlyEnabled = document.getElementById('config-auto-enabled').checked;
|
| 807 |
const autoFriendlyInterval = document.getElementById('config-auto-interval').value;
|
| 808 |
const autoFriendlyChannel = document.getElementById('config-auto-channel').value;
|
|
|
|
|
|
|
| 809 |
|
| 810 |
fetch('/api/config/' + activeGuildId, {
|
| 811 |
method: 'POST',
|
|
@@ -814,7 +850,9 @@ function saveConfig() {
|
|
| 814 |
prefix,
|
| 815 |
autoFriendlyEnabled,
|
| 816 |
autoFriendlyInterval,
|
| 817 |
-
autoFriendlyChannel
|
|
|
|
|
|
|
| 818 |
})
|
| 819 |
})
|
| 820 |
.then(r => r.json())
|
|
|
|
| 654 |
<p style="font-size:12px; color:var(--text-dim); margin-top:16px">When enabled, the bot will automatically post a friendly match poll in the selected channel at the specified interval.</p>
|
| 655 |
</div>
|
| 656 |
|
| 657 |
+
<div style="border-top:1px solid var(--border); padding-top:32px; margin-bottom: 32px;">
|
| 658 |
+
<h4 style="margin-bottom:16px; font-size:15px; color:var(--accent)">📢 Broadcast & Announcements</h4>
|
| 659 |
+
<div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:24px">
|
| 660 |
+
<div>
|
| 661 |
+
<label style="display:block; font-size:13px; color:var(--text-dim); margin-bottom:8px">Receive Broadcasts</label>
|
| 662 |
+
<div style="display:flex; align-items:center; gap:12px">
|
| 663 |
+
<label class="switch">
|
| 664 |
+
<input type="checkbox" id="config-post-enabled">
|
| 665 |
+
<span class="slider"></span>
|
| 666 |
+
</label>
|
| 667 |
+
<span style="font-size:14px; color:var(--text-mid)">Enabled</span>
|
| 668 |
+
</div>
|
| 669 |
+
</div>
|
| 670 |
+
<div>
|
| 671 |
+
<label style="display:block; font-size:13px; color:var(--text-dim); margin-bottom:8px">Broadcast Channel</label>
|
| 672 |
+
<select id="config-post-channel" style="width:100%; padding:12px; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); color:white; outline:none">
|
| 673 |
+
<option value="">Default (System Channel)</option>
|
| 674 |
+
</select>
|
| 675 |
+
</div>
|
| 676 |
+
</div>
|
| 677 |
+
<p style="font-size:12px; color:var(--text-dim); margin-top:16px">Control where global announcements from the bot owner are posted. You can opt-out by disabling this feature.</p>
|
| 678 |
+
</div>
|
| 679 |
+
|
| 680 |
<div style="border-top:1px solid var(--border); padding-top:24px; text-align:right">
|
| 681 |
<button class="invite-btn" onclick="saveConfig()" style="background:var(--accent); color:white; padding:12px 32px">Save All Changes</button>
|
| 682 |
</div>
|
|
|
|
| 805 |
document.getElementById('config-prefix').value = data.prefix || '!';
|
| 806 |
document.getElementById('config-auto-enabled').checked = data.autoFriendlyEnabled || false;
|
| 807 |
document.getElementById('config-auto-interval').value = data.autoFriendlyInterval || 40;
|
| 808 |
+
document.getElementById('config-post-enabled').checked = data.postEnabled !== false;
|
| 809 |
|
| 810 |
// Load channels and set selected
|
| 811 |
fetch('/api/channels/' + id)
|
| 812 |
.then(cr => cr.json())
|
| 813 |
.then(channels => {
|
| 814 |
+
const autoSelect = document.getElementById('config-auto-channel');
|
| 815 |
+
const postSelect = document.getElementById('config-post-channel');
|
| 816 |
+
|
| 817 |
+
autoSelect.innerHTML = '<option value="">Select a channel...</option>';
|
| 818 |
+
postSelect.innerHTML = '<option value="">Default (System Channel)</option>';
|
| 819 |
+
|
| 820 |
channels.forEach(c => {
|
| 821 |
+
const optA = document.createElement('option');
|
| 822 |
+
optA.value = c.id;
|
| 823 |
+
optA.textContent = '#' + c.name;
|
| 824 |
+
if (c.id === data.autoFriendlyChannel) optA.selected = true;
|
| 825 |
+
autoSelect.appendChild(optA);
|
| 826 |
+
|
| 827 |
+
const optP = document.createElement('option');
|
| 828 |
+
optP.value = c.id;
|
| 829 |
+
optP.textContent = '#' + c.name;
|
| 830 |
+
if (c.id === data.postChannelId) optP.selected = true;
|
| 831 |
+
postSelect.appendChild(optP);
|
| 832 |
});
|
| 833 |
});
|
| 834 |
});
|
|
|
|
| 840 |
const autoFriendlyEnabled = document.getElementById('config-auto-enabled').checked;
|
| 841 |
const autoFriendlyInterval = document.getElementById('config-auto-interval').value;
|
| 842 |
const autoFriendlyChannel = document.getElementById('config-auto-channel').value;
|
| 843 |
+
const postEnabled = document.getElementById('config-post-enabled').checked;
|
| 844 |
+
const postChannelId = document.getElementById('config-post-channel').value;
|
| 845 |
|
| 846 |
fetch('/api/config/' + activeGuildId, {
|
| 847 |
method: 'POST',
|
|
|
|
| 850 |
prefix,
|
| 851 |
autoFriendlyEnabled,
|
| 852 |
autoFriendlyInterval,
|
| 853 |
+
autoFriendlyChannel,
|
| 854 |
+
postEnabled,
|
| 855 |
+
postChannelId
|
| 856 |
})
|
| 857 |
})
|
| 858 |
.then(r => r.json())
|