Skip to content

Commit

Permalink
Fix reminder pagination
Browse files Browse the repository at this point in the history
Fixes two issues: One that the subList call shouldn't be there anymore, and another that the pagination arrows did nothing
  • Loading branch information
MrPowerGamerBR committed Feb 21, 2025
1 parent 0daca59 commit 8080c50
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,11 @@ class ReminderCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapper
.toMutableList()
}

val visReminders = reminders.subList(page * REMINDERS_PER_PAGE, Math.min((page * REMINDERS_PER_PAGE) + REMINDERS_PER_PAGE, reminders.size))
val embed = EmbedBuilder()
embed.setTitle("<a:lori_notification:394165039227207710> ${context.locale["$LOCALE_PREFIX.yourReminders"]} (${reminders.size})")
embed.setColor(Color(255, 179, 43))

for ((idx, reminder) in visReminders.withIndex()) {
for ((idx, reminder) in reminders.withIndex()) {
embed.appendDescription(Constants.INDEXES[idx] + " ${reminder.content.substringIfNeeded(0..100)}\n")
}

Expand Down Expand Up @@ -322,7 +321,7 @@ class ReminderCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapper
leftButton
) {
it.deferAndEditOriginal {
createReminderListMessage(context, page).invoke(this)
createReminderListMessage(context, page - 1).invoke(this)
}
}
} else {
Expand All @@ -335,7 +334,7 @@ class ReminderCommand(val loritta: LorittaBot) : SlashCommandDeclarationWrapper
rightButton
) {
it.deferAndEditOriginal {
createReminderListMessage(context, page).invoke(this)
createReminderListMessage(context, page + 1).invoke(this)
}
}
} else {
Expand Down

0 comments on commit 8080c50

Please sign in to comment.