feat(dashboard): leave voice when server/channel set to 없음
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 <noreply@anthropic.com>
This commit is contained in:
@@ -1126,15 +1126,21 @@ function renderBot(s){
|
||||
? '참여자: '+members.map(m=>'<span class="part'+(m.speaking?' spk':'')+'">'+(m.speaking?'🔊':'👤')+' '+esc(m.name||m.id)+'</span>').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(){
|
||||
|
||||
Reference in New Issue
Block a user