Skip to content

Commit

Permalink
Add search for discord sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Nov 10, 2024
1 parent 88e602a commit f8b25f5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ fun Route.sounds() {
else -> it.guildId.value
}
}
.filter { sound ->
if (queryString?.startsWith("name:") == true) {
sound.name.contains(queryString.substringAfter("name:"))
} else if (queryString?.startsWith("tag:") == true) {
sound.guildId.value.toString().contains(queryString.substringAfter("tag:"))
} else {
true
}
}
.groupBy { it.guildId }
.map { (guildId, sounds) ->
val name = guildId.value?.let { kord.getGuild(it) }?.name ?: "Discord"
Expand Down

0 comments on commit f8b25f5

Please sign in to comment.