Nightly: Partymode-Status global per SSE /api/events Broadcast; Panic/Stop/Start senden Status an alle Clients

This commit is contained in:
vibe-bot 2025-08-09 23:20:13 +02:00
parent 23b90b5923
commit 21b4e9bd0c
3 changed files with 51 additions and 1 deletions

View file

@ -106,6 +106,14 @@ export async function partyStop(guildId: string) {
if (!res.ok) throw new Error('Partymode Stop fehlgeschlagen');
}
export function subscribeEvents(onMessage: (data: any)=>void) {
const ev = new EventSource(`${API_BASE}/events`);
ev.onmessage = (e) => {
try { const data = JSON.parse(e.data); onMessage(data); } catch {}
};
return () => ev.close();
}
export async function setVolumeLive(guildId: string, volume: number): Promise<void> {
const res = await fetch(`${API_BASE}/volume`, {
method: 'POST',