spud.js
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

Pagination focused library for Discord.js

Quick Start

Installation

npm i spud.js@latest

and then import into your project

const { PaginationBuilder } = require('spud.js');
// --- OR ---
import { PaginationBuilder } from 'spud.js';

Usage

To get started, make sure you have the necessary boilerplate for your discord bot. Then, within either an InteractionCreate or MessageCreate event, pass the corresponding object into the PaginationBuilder constructor.

const { PaginationBuilder } = require('spud.js');

client.on(Events.InteractionCreate, async (interaction) => {
    if (!interaction.isCommand()) return;   
    // ...

    const pagination = new PaginationBuilder(interaction)
        .setPages([
            {
                embed: new EmbedBuilder()
                    .setTitle('My first page.')
                    .setDescription('With a cool description'),
                components: new ActionRowBuilder()
                    .setComponents(
                        new ButtonBuilder()
                            .setCustomId('page_one_button')
                            .setLabel('First page!')
                            .setStyle(ButtonStyle.Primary)
                    )
            }
        ]);
    
    await pagination.send();
})

This is all that's needed for an extremely basic pagination setup. There are various options you can adjust i.e additonal buttons, custom buttons, filters, collector options and more to fine tune exactly how you want it to operate.

Check your intellisense or browse the documentation to see all available options and join our discord server for any questions!

Acknowledgements

Readme

Keywords

none

Package Sidebar

Install

npm i spud.js

Weekly Downloads

97

Version

4.0.1

License

none

Unpacked Size

37.7 kB

Total Files

14

Last publish

Collaborators

  • mrpotato30
  • keita-sama69
  • n44
  • yuyu_boi