- Notifications
You must be signed in to change notification settings - Fork32
A simple package for pagination using buttons introduced in discord.js v13.
License
ryzyx/discordjs-button-pagination
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple package to paginate discord embeds via discord buttons introduced indiscord.js v13.
for slash command interaction.
for message command.
Formessage
event
npm install discordjs-button-pagination@msg
Forinteraction
event
npm install discordjs-button-pagination@interaction
Node.js 16.6.1 or newer is required along with Discord.js 13.0.0 or newer.
Basic Bot Example
// Import the discordjs-button-pagination packageconstpaginationEmbed=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 thereconst{ MessageEmbed, MessageButton}=require('discord.js');constembed1=newMessageEmbed().setTitle('First Page').setDescription('This is the first page');constembed2=newMessageEmbed().setTitle('Second Page').setDescription('This is the second page');constbutton1=newMessageButton().setCustomId('previousbtn').setLabel('Previous').setStyle('DANGER');constbutton2=newMessageButton().setCustomId('nextbtn').setLabel('Next').setStyle('SUCCESS');// Create an array of embedspages=[embed1,embed2,//....//embedN];//create an array of buttonsbuttonList=[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 120000paginationEmbed(interaction,pages,buttonList,timeout);// There you go, now you have paged embeds
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.
First Page
Second Page
Disabled Buttons after collector end
For any issues or suggestions, kindly open an issue/pull request on theGitHub Repository
About
A simple package for pagination using buttons introduced in discord.js v13.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.