@not_i9/paginate
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

Paginate embeds in Discord.js.

Installation

npm install @not_i9/paginate

Example

// CommonJS
const { paginate } = require("@not_i9/paginate");

// ESM
import { paginate } from "@not_i9/paginate";

// Usage
// interaction must be a ChatInputCommandInteraction

const client = new Client();

const embeds = [
    new EmbedBuilder().setDescription("First embed"),
    new EmbedBuilder().setDescription("Second embed"),
    new EmbedBuilder().setDescription("Third embed"),
];

client.on("interactionCreate", async (interaction) => {
    if (!interaction.isChatInputCommand()) return;
    if (interaction.commandName === "test") {
        await paginate(interaction, embeds, {
            time: 30000, // In milleseconds. Default is 30 seconds, which is the minimum.
            buttons: { // Customize button emojis and labels.
                EXAMPLE_BUTTON: {
                    // Both or one of the following must be used.
                    emoji: "1234567890", // Emoji ID.
                    text: "TEXT HERE" // Button label.
                },

                previous: {
                    emoji: "12345",
                    text: "Previous Page",
                },

                next: {
                    text: "Next Page"
                },

                start: {
                    emoji: "67890"
                }

                // previous, next, and start are the only options.
                // For now, you cannot add any more buttons.
            }
        }); 
    }
});

Package Sidebar

Install

npm i @not_i9/paginate

Weekly Downloads

0

Version

0.0.6

License

ISC

Unpacked Size

16.3 kB

Total Files

6

Last publish

Collaborators

  • not_i9