From 7ea07c13ad6054b96d042b6c513a8ce885e04e5e Mon Sep 17 00:00:00 2001 From: EJClaw Date: Sat, 22 Aug 2026 22:15:42 +0900 Subject: [PATCH] =?UTF-8?q?feat(dashboard):=20leave=20voice=20when=20serve?= =?UTF-8?q?r/channel=20set=20to=20=EC=97=86=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The voice-channel picker already switched channels / left on 없음. Now the server picker does too: choosing 없음 (or switching to a server with no channel selected) sends a leave so the bot exits its current voice channel. Factored the select POST into sendSelect(guildId, channelId). Co-Authored-By: Claude Opus 4.7 --- wsai/dashboard.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/wsai/dashboard.py b/wsai/dashboard.py index 2d754cb..038b86a 100644 --- a/wsai/dashboard.py +++ b/wsai/dashboard.py @@ -1126,15 +1126,21 @@ function renderBot(s){ ? '참여자: '+members.map(m=>''+(m.speaking?'🔊':'👤')+' '+esc(m.name||m.id)+'').join('') : (s&&s.connected&&cur.channelId ? '참여자: (없음)' : ''); } -$('guildSel').onchange = ()=>{ userPickedGuild=$('guildSel').value; renderBot(botState); }; -$('vcSel').onchange = async ()=>{ - const guildId=$('guildSel').value, channelId=$('vcSel').value; +async function sendSelect(guildId, channelId){ try{ await fetch('/api/bot/select',{method:'POST',headers:{'Content-Type':'application/json'}, body:JSON.stringify({guildId, channelId})}); - toast(channelId?'음성채널 참여 요청을 보냈습니다':'나가기 요청을 보냈습니다'); + toast(channelId?'음성채널 참여 요청을 보냈습니다':'음성채널에서 나가기 요청을 보냈습니다'); }catch(e){ toast('요청 실패: '+e); } +} +$('guildSel').onchange = ()=>{ + userPickedGuild = $('guildSel').value; + renderBot(botState); // 선택 서버의 음성채널 목록을 다시 채운다 + // 서버를 '없음'으로 두거나 다른 서버로 바꿔 음성채널이 선택되지 않은 상태면 나간다. + if(!$('vcSel').value) sendSelect($('guildSel').value, ''); }; +// 음성채널 변경 → 그 채널로 이동, '없음' → 나가기. +$('vcSel').onchange = ()=> sendSelect($('guildSel').value, $('vcSel').value); // --- 화이트/블랙리스트 팝업 (유저·역할 검색 → 화이트/블랙 추가·제거) ------ # const LKEY = {wu:'whitelistUsers', bu:'blacklistUsers', wr:'whitelistRoles', br:'blacklistRoles'}; async function openLists(){