0.0.6 • Published 2 years ago

@not_i9/paginate v0.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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.
            }
        }); 
    }
});
0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

1.0.0

2 years ago