PaginatedMessage extended with editing the select menu options does not work as expected

I am readjusting certain things from my old class to that of @sapphire/discord.js-utilises I have noticed that my old class works as expected but this one does not, it adds another option and if I click it it gives an error new method for the current class: https://srcb.in/Hr0PPd6c7U old method for the old class: https://srcb.in/RZsP4GHSwV I can't understand what's wrong
SourceBin
using the new class
Instantly share your code with the world.
13 Replies
RedStar ⭐
RedStar ⭐14mo ago
if you want, I'll send the new and old class
Duck
Duck14mo ago
send the error
RedStar ⭐
RedStar ⭐14mo ago
RedStar ⭐
RedStar ⭐14mo ago
this error I already know
Duck
Duck14mo ago
If it's the map causing issues
chunk(this.genaratedOptions, 10)[this.displaySubPage].map
chunk(this.genaratedOptions, 10)[this.displaySubPage].map
Then you are likely trying to access an item that doesn't exist
RedStar ⭐
RedStar ⭐14mo ago
I am sending you an image and of the unexpected thing
RedStar ⭐
RedStar ⭐14mo ago
that last option should not come out I expect as behaviour that if the total number of pages that would be this.pages is greater than 10 it will split it into chunked arrays and add an option to pass the next chunked array as long as it is possible to pass the next chunked array
Duck
Duck14mo ago
It's hard to say without the rest of the file to give context
RedStar ⭐
RedStar ⭐14mo ago
do you want both files?
Duck
Duck14mo ago
just the new one will do
Duck
Duck14mo ago
Here
if (
this.selectStringOptions.at(-1)!.index === 9 &&
this.genaratedOptions.length > 10
)
this.selectStringOptions.push({
label: `Continue to next page of ${SubPage + 2}/${GenOptions}`,
value: `+${this.displaySubPage}/${
chunk(this.genaratedOptions, 10).length
}`,
});
if (
this.selectStringOptions.at(-1)!.index === 9 &&
this.genaratedOptions.length > 10
)
this.selectStringOptions.push({
label: `Continue to next page of ${SubPage + 2}/${GenOptions}`,
value: `+${this.displaySubPage}/${
chunk(this.genaratedOptions, 10).length
}`,
});
Try replacing this.genaratedOptions.length > 10 with GenOptions > SubPage + 2 Without actually executing it's hard to say precisely what it's doing but if you try comparing GenOptions and SubPage it might be more consistent
RedStar ⭐
RedStar ⭐14mo ago
I managed to fix the issue