Skip to content

Commit

Permalink
Actually limit the query results, instead of filtering after the fact
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPowerGamerBR committed Nov 10, 2024
1 parent 89025f9 commit d8327a8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class RepCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapper {
Reputations.receivedById eq context.event.user.idLong and (Reputations.content.like("%${context.event.focusedOption.value.replace("%", "")}%"))
}
.orderBy(Reputations.receivedAt, SortOrder.DESC)
.limit(DiscordResourceLimits.Command.Options.ChoicesCount)
.map {
// TODO: This is from Pudding's Service class, we moved it here because it is a extension method there, can't we refactor this?
PuddingReputation(
Expand All @@ -163,7 +164,6 @@ class RepCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapper {
return@autocomplete reputations
.associate { formatReputation(it, context) to it.id.toString() }
.entries
.take(DiscordResourceLimits.Command.Options.ChoicesCount)
.associate { it.key to it.value }
}
}
Expand Down

0 comments on commit d8327a8

Please sign in to comment.