acegoal07 / discordjs-pagination

A pagination package for Discord.js
https://acegoal07.dev
MIT License
6 stars 3 forks source link

TypeError: Pagination is not a constructor #18

Closed rctgamer3 closed 11 months ago

rctgamer3 commented 11 months ago

Describe the bug Code on the wiki doesn't work at all. Can't even assign Pagination to a variable without setting any options. Error message TypeError: Pagination is not a constructor

Sample of the code where it is used

const Pagination = require("@acegoal07/discordjs-pagination");
new Pagination().setPortal(interaction)
    .setPageList([
        new EmbedBuilder()
            .setTitle("Embed 1")
            .setDescription("page 1"),
        new EmbedBuilder()
            .setTitle("Embed 2")
            .setDescription("page 2")
    ])
    .setButtonList([
        new ButtonBuilder()
            .setLabel(`1`)
            .setStyle("Secondary")
            .setCustomId(`1`),
        new ButtonBuilder()
            .setLabel(`2`)
            .setStyle("Secondary")
            .setCustomId(`2`)
    ])
    .paginate();

Additional info

acegoal07 commented 11 months ago

Can you just try changing the const call to the package to this

const { Pagination } = require("@acegoal07/discordjs-pagination");

Edit:

Or to use the call to the package your using you would need to use this

new Pagination.Pagination()
rctgamer3 commented 11 months ago

Oh dang. I was fixated on fixing up my code but never noticed i fumbled up that part. Sorry for the beginners mistake.