Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A simple package for pagination using buttons introduced in discord.js v13.

License

NotificationsYou must be signed in to change notification settings

ryzyx/discordjs-button-pagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discordjs-pagination

NPM info

discordjs-button-pagination

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

Versions

discordjs-button-pagination@interaction [Default]

for slash command interaction.

discordjs-button-pagination@msg

for message command.

Installation

Formessage event

  • npm install discordjs-button-pagination@msg

Forinteraction event

  • npm install discordjs-button-pagination@interaction

Default command:npm install discordjs-button-pagination will install theinteraction 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 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

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 theGitHub Repository

About

A simple package for pagination using buttons introduced in discord.js v13.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors8


[8]ページ先頭

©2009-2025 Movatter.jp