Paginination limitation when not using select menus

I have the following error being presented to me
(node:1484241) [PAGINATED_MESSAGE_EXCEEDED_MAXIMUM_AMOUNT_OF_PAGES] PaginatedMessageExceededMessagePageAmount: Maximum amount of pages exceeded for PaginatedMessage. Please check your instance of PaginatedMessage and ensure that you do not exceed 25 pages total.
If you do need more than 25 pages you can extend the class and overwrite the actions in the constructor.
and this is my current code giving the error:
import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import { EmbedBuilder } from 'discord.js';

export function movieResponseRebuilder(movieResponse: object) {
    console.log('movie Response: ', JSON.stringify(movieResponse));

    const display = new PaginatedMessage({
        template: new EmbedBuilder().setColor('#8E44AD')
    });

    movieResponse.forEach((movie) => {
        display.addPageEmbed((embed) => {
            embed //
                .addFields({
                    name: 'Test Name',
                    value: 'Test value'
                });
            return embed;
        });
        console.log('looped movie data', JSON.stringify(movie));
    });

    return display;
}

movieResponse
is an array of objects that can exceed 25 objects. how do I get around this error as you can see, I don't have any menus in place in my embed code.
Solution
Extend the class and override the addPage method.

Never forget the basic principles of object oriented programming. You can achieve a lot with simple class extension.
Was this page helpful?