@@ -38,7 +38,7 @@ public final class AuditCommand extends SlashCommandAdapter {
3838 private static final String TARGET_OPTION = "user" ;
3939 private static final String COMMAND_NAME = "audit" ;
4040 private static final String ACTION_VERB = "audit" ;
41- private static final int MAX_PAGE_LENGTH = 25 ;
41+ private static final int MAX_PAGE_LENGTH = 10 ;
4242 private static final String PREVIOUS_BUTTON_LABEL = "⬅" ;
4343 private static final String NEXT_BUTTON_LABEL = "➡" ;
4444 private final Predicate <String > hasRequiredRole ;
@@ -76,7 +76,7 @@ public void onSlashCommand(@NotNull SlashCommandInteractionEvent event) {
7676 return ;
7777 }
7878
79- auditUser (guild .getIdLong (), target .getIdLong (), event .getMember ().getIdLong (), 1 ,
79+ auditUser (guild .getIdLong (), target .getIdLong (), event .getMember ().getIdLong (), - 1 ,
8080 event .getJDA ()).flatMap (event ::reply ).queue ();
8181 }
8282
@@ -93,14 +93,21 @@ private boolean handleChecks(@NotNull Member bot, @NotNull Member author,
9393
9494 /**
9595 * @param pageNumber page number to display when actions are divided into pages and each page
96- * can contain {@link AuditCommand#MAX_PAGE_LENGTH} actions
96+ * can contain {@link AuditCommand#MAX_PAGE_LENGTH} actions, {@code -1} encodes the last
97+ * page
9798 */
9899 private @ NotNull RestAction <Message > auditUser (long guildId , long targetId , long callerId ,
99100 int pageNumber , @ NotNull JDA jda ) {
100101 List <ActionRecord > actions = actionsStore .getActionsByTargetAscending (guildId , targetId );
101102 List <List <ActionRecord >> groupedActions = groupActionsByPages (actions );
102103 int totalPages = groupedActions .size ();
103- int pageNumberInLimits = clamp (1 , pageNumber , totalPages );
104+
105+ int pageNumberInLimits ;
106+ if (pageNumber == -1 ) {
107+ pageNumberInLimits = totalPages ;
108+ } else {
109+ pageNumberInLimits = clamp (1 , pageNumber , totalPages );
110+ }
104111
105112 return jda .retrieveUserById (targetId )
106113 .map (user -> createSummaryEmbed (user , actions ))
0 commit comments