Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 1.94 KB

README.md

File metadata and controls

51 lines (41 loc) · 1.94 KB

Quick start

If you reading this - you probably wanted pagination, don't worry, we gotchu!

First, install the package. (No sh*t, Sherlock)

npm i spud.js@latest

current version is; 2.0.0 After it's done installing, import it to your project/file:

const Spud = require('spud.js');

Easy as that.

A simple example of the pagination:

const { ButtonPaginationBuilder } = require('spud.js');
const { Client, MessageEmbed } = require('discord.js')
const client = new Client({...});

client.on('messageCreate', (message) => {
  const page1 = new MessageEmbed().setDescription('This is page 1')
  const page2 = new MessageEmbed().setDescription('This is page 1')
  if (message.content === 'pagination') {
    const pagination = new ButtonPaginationBuilder(message)
      .setEmbeds(page1, page2)

    pagination.send()
  }
})

Message and Embeds are required on paginations, add an embed or set embeds using .addEmbeds(...) or .setEmbeds(...)


Of course that is an example, but if you were to do something more advanced, let's add a 1 minute timer and enable fast skip for convenience

const pagination = new ButtonPaginationBuilder(message)
  .setEmbeds(page1, page2)
  .setTimer(60000) // *optional (default 0)
  .fastSkip(true) // *optional (default false)

pagination.send()

Now our the pagination buttons will automatically be disabled after a minute, Pretty simple stuff right?

And thats it for the quickstart! To explore all available features and options, feel free to look inside our docs or visit our website!

Please join our support server! Don't miss out next spud.js updates! 😉