feat(channel): Serverweite Channel-Auswahl mit Persistenz und SSE-Broadcast; Frontend passt Auswahl global an

This commit is contained in:
vibe-bot 2025-08-10 18:47:33 +02:00
parent fdf0dea3e6
commit e83954624c
4 changed files with 111 additions and 14 deletions

View file

@ -79,6 +79,21 @@ export async function fetchChannels(): Promise<VoiceChannelInfo[]> {
return res.json();
}
export async function getSelectedChannels(): Promise<Record<string, string>> {
const res = await fetch(`${API_BASE}/selected-channels`);
if (!res.ok) throw new Error('Fehler beim Laden der Channel-Auswahl');
const data = await res.json();
return data?.selected || {};
}
export async function setSelectedChannel(guildId: string, channelId: string): Promise<void> {
const res = await fetch(`${API_BASE}/selected-channel`, {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ guildId, channelId })
});
if (!res.ok) throw new Error('Channel-Auswahl setzen fehlgeschlagen');
}
export async function playSound(soundName: string, guildId: string, channelId: string, volume: number, relativePath?: string): Promise<void> {
const res = await fetch(`${API_BASE}/play`, {
method: 'POST',