diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index fdf8d99..f8467b4 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 87f67d5..e9e7d07 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + \ No newline at end of file diff --git a/bot/src/main/kotlin/dev/schlaubi/tonbrett/bot/server/WebSocket.kt b/bot/src/main/kotlin/dev/schlaubi/tonbrett/bot/server/WebSocket.kt index 6bd39bf..6114655 100644 --- a/bot/src/main/kotlin/dev/schlaubi/tonbrett/bot/server/WebSocket.kt +++ b/bot/src/main/kotlin/dev/schlaubi/tonbrett/bot/server/WebSocket.kt @@ -59,9 +59,11 @@ suspend fun sendEvent(id: Snowflake, event: Event) { } suspend fun broadcastEvent(event: Event) = coroutineScope { - sessions.forEach { (_, session) -> - launch { - session.sendEvent(event) + sessions.forEach { (user, session) -> + if (event !is HasSound || !event.sound.public && event.sound.owner == user) { + launch { + session.sendEvent(event) + } } } }