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
Starr Rossa
Starr RossaOP2y ago
if you want, I'll send the new and old class
Duck
Duck2y ago
send the error
Starr Rossa
Starr RossaOP2y ago
Starr Rossa
Starr RossaOP2y ago
this error I already know
Duck
Duck2y 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
Starr Rossa
Starr RossaOP2y ago
I am sending you an image and of the unexpected thing
Starr Rossa
Starr RossaOP2y 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
Duck2y ago
It's hard to say without the rest of the file to give context
Starr Rossa
Starr RossaOP2y ago
do you want both files?
Duck
Duck2y ago
just the new one will do
Duck
Duck2y 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
Starr Rossa
Starr RossaOP2y ago
I managed to fix the issue
Want results from more Discord servers?
Add your server