Skip to content

Commit b5e1eaa

Browse files
twitch fix
1 parent d793d26 commit b5e1eaa

2 files changed

Lines changed: 158 additions & 2 deletions

File tree

app.js

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,13 @@ function populateForm(d) {
458458
set('cfg-yt-channel-id',d.yt_channel_id); set('cfg-yt-alert-channel',d.yt_alert_channel_id);
459459
set('cfg-yt-alert-msg',d.yt_alert_message);
460460
set('cfg-tw-alerts',d.tw_alerts); set('cfg-tw-username',d.tw_username);
461+
set('cfg-tw-vc-followers',d.tw_vc_followers||''); set('cfg-tw-vc-status',d.tw_vc_status||'');
462+
set('cfg-tw-vc-viewers',d.tw_vc_viewers||''); set('cfg-tw-vc-game',d.tw_vc_game||'');
463+
setVcFmt('followers', d.tw_fmt_followers || '🪻 | Followers : {value}');
464+
setVcFmt('status-live', d.tw_fmt_status_live || '🪻 | Status : 🔴 LIVE');
465+
setVcFmt('status-offline',d.tw_fmt_status_offline|| '🪻 | Status : ⚫ Offline');
466+
setVcFmt('viewers', d.tw_fmt_viewers || '🪻 | Viewers : {value}');
467+
setVcFmt('game', d.tw_fmt_game || '🪻 | Game : {value}');
461468
set('cfg-tw-alert-channel',d.tw_alert_channel_id); set('cfg-tw-alert-msg',d.tw_alert_message);
462469
set('cfg-tw-statsvc',d.tw_stats_vc); set('cfg-yt-statsvc',d.yt_stats_vc);
463470
set('cfg-boost-enabled',d.boost_enabled); set('cfg-boost-channel',d.boost_channel_id);
@@ -522,7 +529,12 @@ function buildPayload(cat) {
522529
yt_alert_channel_id:v('cfg-yt-alert-channel'), yt_alert_message:v('cfg-yt-alert-msg'),
523530
tw_alerts:vb('cfg-tw-alerts'), tw_username:v('cfg-tw-username'),
524531
tw_alert_channel_id:v('cfg-tw-alert-channel'), tw_alert_message:v('cfg-tw-alert-msg'),
525-
tw_stats_vc:vb('cfg-tw-statsvc'), yt_stats_vc:vb('cfg-yt-statsvc') },
532+
tw_stats_vc:vb('cfg-tw-statsvc'), yt_stats_vc:vb('cfg-yt-statsvc'),
533+
tw_vc_followers:v('cfg-tw-vc-followers'), tw_vc_status:v('cfg-tw-vc-status'),
534+
tw_vc_viewers:v('cfg-tw-vc-viewers'), tw_vc_game:v('cfg-tw-vc-game'),
535+
tw_fmt_followers:getVcFmt('followers'), tw_fmt_status_live:getVcFmt('status-live'),
536+
tw_fmt_status_offline:getVcFmt('status-offline'), tw_fmt_viewers:getVcFmt('viewers'),
537+
tw_fmt_game:getVcFmt('game') },
526538
booster: { boost_enabled:vb('cfg-boost-enabled'), boost_channel_id:v('cfg-boost-channel'),
527539
boost_message:v('cfg-boost-msg'), boost_gradient:boostGrad, boost_accent:boostAccent, boost_emoji:boostEmoji },
528540
moderation: { antispam_enabled:vb('cfg-antispam'), link_filter_enabled:vb('cfg-linkfilter'),
@@ -1584,3 +1596,70 @@ timeout_ms: 5000
15841596
if (id === 'minecraft') mcLoadSettings();
15851597
};
15861598
})();
1599+
1600+
// ── VC Format Picker ─────────────────────────────────────────────────────────
1601+
1602+
const VC_FMT_SAMPLE = {
1603+
followers: '1,234',
1604+
viewers: '89',
1605+
game: 'Minecraft',
1606+
};
1607+
1608+
const VC_FMT_IDS = {
1609+
'followers': 'cfg-tw-fmt-followers',
1610+
'status-live': 'cfg-tw-fmt-status-live',
1611+
'status-offline':'cfg-tw-fmt-status-offline',
1612+
'viewers': 'cfg-tw-fmt-viewers',
1613+
'game': 'cfg-tw-fmt-game',
1614+
};
1615+
1616+
function applyVcPreset(key) {
1617+
const preset = document.getElementById(VC_FMT_IDS[key] + '-preset');
1618+
const input = document.getElementById(VC_FMT_IDS[key]);
1619+
if (!preset || !input) return;
1620+
if (preset.value === '__custom__') {
1621+
input.style.display = '';
1622+
input.focus();
1623+
} else {
1624+
input.style.display = 'none';
1625+
input.value = preset.value;
1626+
}
1627+
markDirty('streams');
1628+
updateVcPreview(key);
1629+
}
1630+
1631+
function updateVcPreview(key) {
1632+
const input = document.getElementById(VC_FMT_IDS[key]);
1633+
const preview = document.getElementById('prev-' + key);
1634+
if (!input || !preview) return;
1635+
const sample = VC_FMT_SAMPLE[key] || '';
1636+
const text = input.value.replace('{value}', sample);
1637+
preview.textContent = text || '';
1638+
}
1639+
1640+
function getVcFmt(key) {
1641+
const preset = document.getElementById(VC_FMT_IDS[key] + '-preset');
1642+
const input = document.getElementById(VC_FMT_IDS[key]);
1643+
if (!preset) return '';
1644+
return preset.value === '__custom__' ? (input ? input.value : '') : preset.value;
1645+
}
1646+
1647+
function setVcFmt(key, val) {
1648+
const preset = document.getElementById(VC_FMT_IDS[key] + '-preset');
1649+
const input = document.getElementById(VC_FMT_IDS[key]);
1650+
if (!preset) return;
1651+
// Check if val matches a preset option
1652+
let matched = false;
1653+
for (const opt of preset.options) {
1654+
if (opt.value === val && opt.value !== '__custom__') {
1655+
preset.value = val;
1656+
if (input) { input.style.display = 'none'; input.value = val; }
1657+
matched = true; break;
1658+
}
1659+
}
1660+
if (!matched && val) {
1661+
preset.value = '__custom__';
1662+
if (input) { input.style.display = ''; input.value = val; }
1663+
}
1664+
updateVcPreview(key);
1665+
}

dashboard.html

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
.bk-empty-t{font-size:0.88rem;font-weight:700;color:var(--tx-2);margin-top:4px}
5555
.bk-empty-s{font-size:0.72rem;color:var(--tx-3);max-width:180px;line-height:1.6;font-family:var(--font-m)}
5656
@media(max-width:860px){.bk-grid{grid-template-columns:1fr}}
57+
.vc-preview{margin-top:7px;padding:6px 12px;border-radius:8px;background:rgba(145,70,255,0.10);border:1px solid rgba(145,70,255,0.22);font-size:0.78rem;color:var(--tx-2);font-family:var(--font-m);letter-spacing:0.01em;min-height:28px;display:flex;align-items:center;gap:6px}
58+
.vc-preview::before{content:"🔊";font-size:0.82rem;opacity:0.7}
59+
.vc-preview:empty{display:none}
5760
</style>
5861
</head>
5962
<body class="db-body">
@@ -460,7 +463,81 @@ <h3>📦 Module Status</h3>
460463
<div class="settings-section">
461464
<div class="settings-section-title">📊 Stats VC Channels</div>
462465
<div class="toggle-row"><div class="toggle-info"><div class="toggle-name">Twitch Stats VC</div><div class="toggle-desc">Live follower/viewer count in VC name</div></div><label class="toggle"><input type="checkbox" id="cfg-tw-statsvc" checked onchange="markDirty('streams')"><span class="toggle-track"></span></label></div>
463-
<div class="toggle-row"><div class="toggle-info"><div class="toggle-name">YouTube Stats VC</div><div class="toggle-desc">Live subscriber/view count in VC name</div></div><label class="toggle"><input type="checkbox" id="cfg-yt-statsvc" onchange="markDirty('streams')"><span class="toggle-track"></span></label></div>
466+
<div class="field" style="margin-top:14px"><label class="field-label">Followers VC ID</label><input type="text" id="cfg-tw-vc-followers" class="f-input" placeholder="Right-click VC → Copy ID" oninput="markDirty('streams')"></div>
467+
<div class="field"><label class="field-label">Status VC ID</label><input type="text" id="cfg-tw-vc-status" class="f-input" placeholder="Right-click VC → Copy ID" oninput="markDirty('streams')"></div>
468+
<div class="field"><label class="field-label">Viewers VC ID</label><input type="text" id="cfg-tw-vc-viewers" class="f-input" placeholder="Right-click VC → Copy ID" oninput="markDirty('streams')"></div>
469+
<div class="field"><label class="field-label">Game VC ID</label><input type="text" id="cfg-tw-vc-game" class="f-input" placeholder="Right-click VC → Copy ID" oninput="markDirty('streams')"></div>
470+
<div class="toggle-row" style="margin-top:14px"><div class="toggle-info"><div class="toggle-name">YouTube Stats VC</div><div class="toggle-desc">Live subscriber/view count in VC name</div></div><label class="toggle"><input type="checkbox" id="cfg-yt-statsvc" onchange="markDirty('streams')"><span class="toggle-track"></span></label></div>
471+
</div>
472+
<div class="settings-section">
473+
<div class="settings-section-title">✏️ VC Name Formats</div>
474+
<p style="font-size:12px;color:var(--muted);margin:0 0 14px 0">Customise how each stat channel is named. Use <code style="background:rgba(255,255,255,.08);padding:1px 5px;border-radius:4px">{value}</code> as placeholder for the live stat.</p>
475+
476+
<div class="field">
477+
<label class="field-label">Followers VC</label>
478+
<select id="cfg-tw-fmt-followers-preset" class="f-select" onchange="applyVcPreset('followers')">
479+
<option value="🪻 | Followers : {value}">🪻 | Followers : {value}</option>
480+
<option value="👥 Followers ➜ {value}">👥 Followers ➜ {value}</option>
481+
<option value="📊 Followers • {value}">📊 Followers • {value}</option>
482+
<option value="[Followers] {value}">[Followers] {value}</option>
483+
<option value="Followers: {value}">Followers: {value}</option>
484+
<option value="__custom__">✏️ Custom…</option>
485+
</select>
486+
<input type="text" id="cfg-tw-fmt-followers" class="f-input" style="margin-top:6px;display:none" placeholder="e.g. 🪻 | Followers : {value}" oninput="markDirty('streams');updateVcPreview('followers')">
487+
<div class="vc-preview" id="prev-followers"></div>
488+
</div>
489+
490+
<div class="field">
491+
<label class="field-label">Status VC — when LIVE</label>
492+
<select id="cfg-tw-fmt-status-live-preset" class="f-select" onchange="applyVcPreset('status-live')">
493+
<option value="🪻 | Status : 🔴 LIVE">🪻 | Status : 🔴 LIVE</option>
494+
<option value="🔴 Currently LIVE">🔴 Currently LIVE</option>
495+
<option value="🟣 Streaming NOW">🟣 Streaming NOW</option>
496+
<option value="✅ Online">✅ Online</option>
497+
<option value="__custom__">✏️ Custom…</option>
498+
</select>
499+
<input type="text" id="cfg-tw-fmt-status-live" class="f-input" style="margin-top:6px;display:none" placeholder="e.g. 🪻 | Status : 🔴 LIVE" oninput="markDirty('streams');updateVcPreview('status-live')">
500+
<div class="vc-preview" id="prev-status-live"></div>
501+
</div>
502+
503+
<div class="field">
504+
<label class="field-label">Status VC — when Offline</label>
505+
<select id="cfg-tw-fmt-status-offline-preset" class="f-select" onchange="applyVcPreset('status-offline')">
506+
<option value="🪻 | Status : ⚫ Offline">🪻 | Status : ⚫ Offline</option>
507+
<option value="⚫ OFFLINE">⚫ OFFLINE</option>
508+
<option value="💤 Not Streaming">💤 Not Streaming</option>
509+
<option value="❌ Offline">❌ Offline</option>
510+
<option value="__custom__">✏️ Custom…</option>
511+
</select>
512+
<input type="text" id="cfg-tw-fmt-status-offline" class="f-input" style="margin-top:6px;display:none" placeholder="e.g. 🪻 | Status : ⚫ Offline" oninput="markDirty('streams');updateVcPreview('status-offline')">
513+
<div class="vc-preview" id="prev-status-offline"></div>
514+
</div>
515+
516+
<div class="field">
517+
<label class="field-label">Viewers VC</label>
518+
<select id="cfg-tw-fmt-viewers-preset" class="f-select" onchange="applyVcPreset('viewers')">
519+
<option value="🪻 | Viewers : {value}">🪻 | Viewers : {value}</option>
520+
<option value="👁️ Viewers ➜ {value}">👁️ Viewers ➜ {value}</option>
521+
<option value="📺 Viewers • {value}">📺 Viewers • {value}</option>
522+
<option value="Viewers: {value}">Viewers: {value}</option>
523+
<option value="__custom__">✏️ Custom…</option>
524+
</select>
525+
<input type="text" id="cfg-tw-fmt-viewers" class="f-input" style="margin-top:6px;display:none" placeholder="e.g. 🪻 | Viewers : {value}" oninput="markDirty('streams');updateVcPreview('viewers')">
526+
<div class="vc-preview" id="prev-viewers"></div>
527+
</div>
528+
529+
<div class="field">
530+
<label class="field-label">Game VC</label>
531+
<select id="cfg-tw-fmt-game-preset" class="f-select" onchange="applyVcPreset('game')">
532+
<option value="🪻 | Game : {value}">🪻 | Game : {value}</option>
533+
<option value="🎮 Playing: {value}">🎮 Playing: {value}</option>
534+
<option value="🕹️ Game ➜ {value}">🕹️ Game ➜ {value}</option>
535+
<option value="[Game] {value}">[Game] {value}</option>
536+
<option value="__custom__">✏️ Custom…</option>
537+
</select>
538+
<input type="text" id="cfg-tw-fmt-game" class="f-input" style="margin-top:6px;display:none" placeholder="e.g. 🪻 | Game : {value}" oninput="markDirty('streams');updateVcPreview('game')">
539+
<div class="vc-preview" id="prev-game"></div>
540+
</div>
464541
</div>
465542
</div>
466543
</div>

0 commit comments

Comments
 (0)