All Projects → ryzyx → discordjs-button-pagination

ryzyx / discordjs-button-pagination

Licence: MIT License
A simple package for pagination using buttons introduced in discord.js v13.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to discordjs-button-pagination

DiscordBot-Template
A boilerplate / template for discord.js bots with 100% coverage of Discord API, command handler, error handler based on https://discordjs.guide/
Stars: ✭ 129 (+230.77%)
Mutual labels:  buttons, discord-js
reactionmenu
A library to create a discord paginator. Supports pagination with Discords Buttons feature and reactions.
Stars: ✭ 68 (+74.36%)
Mutual labels:  buttons, paginator
simply-djs
A Simple, Easy and Beginner friendly Discord.js Package for everyone. Uses Discord.js v13
Stars: ✭ 62 (+58.97%)
Mutual labels:  buttons, discord-js
Discord-multipurpose-bot
A repository with JavaScript and Python versions of the same type of discord commands.
Stars: ✭ 27 (-30.77%)
Mutual labels:  paginator, discord-js
todobot
📝🤖 Simple, efficient and most importantly elegant TODO Bot. A virtual TODO List right inside your Discord server!
Stars: ✭ 32 (-17.95%)
Mutual labels:  discord-js
Invite-Manager
Invite manager is an open-source discord bot that allows you to track the invites of people who join your server.
Stars: ✭ 90 (+130.77%)
Mutual labels:  discord-js
Menhera-Chan
A multi-purpose discord bot. With Dashboard
Stars: ✭ 28 (-28.21%)
Mutual labels:  discord-js
FFGNDS-Discord-Dice-Roller
Discord dice roller for EotE, AoR, FnD, Genesys, and L5R role playing games.
Stars: ✭ 63 (+61.54%)
Mutual labels:  discord-js
button-entity-row
Adds buttons to call services to entity cards
Stars: ✭ 73 (+87.18%)
Mutual labels:  buttons
SparkV
🤖⚡ | The most POWERFUL multipurpose chat/meme bot that will boost the activity in your server.
Stars: ✭ 24 (-38.46%)
Mutual labels:  discord-js
ticketbot
Discord.js Ticket bot using Quick.db (DJS V11)
Stars: ✭ 49 (+25.64%)
Mutual labels:  discord-js
Discord-Tools
VSCode extension allowing the integration of a Discord chat, bot templates, snippets, themes and more!
Stars: ✭ 91 (+133.33%)
Mutual labels:  discord-js
Calcifer
Run Pomodoro timers on Discord. It also uses a database for your study habit stats.
Stars: ✭ 36 (-7.69%)
Mutual labels:  discord-js
aioneframework
Aione Framework: All-in-one lightweight mobile first front-end framework to design websites, web applications, mobile applications, progressive web applications having large number of examples, documentation, tutorials, community support, components.
Stars: ✭ 13 (-66.67%)
Mutual labels:  buttons
streamdeck
Golang API for the Corsair / Elgato StreamDeck
Stars: ✭ 46 (+17.95%)
Mutual labels:  buttons
AwesomeBot
chatbot for /r/learnprogramming (un)offical discord channel
Stars: ✭ 25 (-35.9%)
Mutual labels:  discord-js
BrokenDisc
A discord music bot || NO CODING NEEDED!
Stars: ✭ 52 (+33.33%)
Mutual labels:  discord-js
Recording-Bot
A bot built to record and transcribe audio fragments from Discord.
Stars: ✭ 22 (-43.59%)
Mutual labels:  discord-js
minesweeper-bot
I'm a Discord bot that can generate a random Minesweeper game using spoiler tags, for anyone to play!
Stars: ✭ 27 (-30.77%)
Mutual labels:  discord-js
SpikeyBot-Discord
SpikeyBot for Discord. Hunger Games simulator, and other helpful commands.
Stars: ✭ 28 (-28.21%)
Mutual labels:  discord-js

discordjs-pagination

NPM info

discordjs-button-pagination

A simple package to paginate discord embeds via discord buttons introduced in discord.js v13.

Versions

discordjs-button-pagination@interaction [Default]

for slash command interaction.

discordjs-button-pagination@msg

for message command.

Installation

For message event

  • npm install discordjs-button-pagination@msg

For interaction event

  • npm install discordjs-button-pagination@interaction

Default command: npm install discordjs-button-pagination will install the interaction version

Requirements

Node.js 16.6.1 or newer is required along with Discord.js 13.0.0 or newer.

Usage for Interaction (Slash Command)

Basic Bot Example

// Import the discordjs-button-pagination package
const paginationEmbed = require('discordjs-button-pagination');

// Use MessageEmbed to make pages
// Keep in mind that Embeds should't have their footers set since the pagination method sets page info there
const { MessageEmbed , MessageButton} = require('discord.js');
const embed1 = new MessageEmbed()
                .setTitle('First Page')
                .setDescription('This is the first page');

const embed2 = new MessageEmbed()
                .setTitle('Second Page')
                .setDescription('This is the second page');

const button1 = new MessageButton()
                .setCustomId('previousbtn')
                .setLabel('Previous')
                .setStyle('DANGER');

const button2 = new MessageButton()
                .setCustomId('nextbtn')
                .setLabel('Next')
                .setStyle('SUCCESS');

// Create an array of embeds
pages = [
	embed1,
	embed2,
	//....
	//embedN
];

//create an array of buttons

buttonList = [
    button1,
    button2
]


// Call the paginationEmbed method, first three arguments are required
// timeout is the time till the reaction collectors are active, after this you can't change pages (in ms), defaults to 120000
paginationEmbed(interaction, pages, buttonList, timeout);
// There you go, now you have paged embeds

Note

This will not work with buttons whose style is set as 'LINK' as they do not trigger an interaction event. The buttons will auto disable once the the collector ends after the timeout.

The collector timer resets after receiving a button interaction.

Preview

First Page

pic1

Second Page

pic2

Disabled Buttons after collector end

pic3

For any issues or suggestions, kindly open an issue/pull request on the GitHub Repository

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].