Skip to content

Commit

Permalink
Only send private sounds events to their owners
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Sep 17, 2023
1 parent 05a2ef3 commit 13e6a34
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit 13e6a34

Please sign in to comment.