discord-button-embed-pagination
v1.0.3
Published
Pagination
Downloads
3
Maintainers
Readme
Discord.js Button Embed Pagination
Usage
- Simple Pagination
const { MessageEmbed, Client, Intents } = require("discord.js"); const embeds = [ new MessageEmbed().setTitle("Demo Page 1"), new MessageEmbed().setTitle("Demo page 2"), new MessageEmbed().setTitle("Demo page 3") ]; const { Pagination } = require("discord-button-embed-pagination"); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); client.on('messageCreate', async message => { if (message.content === "!pagination") { const page = new Pagination(embeds); await page.sendTo(message.channel,/* Send channel */ message.author /* UserResolvable of the user who can click the button */ ); } })
Options
Pagination Class
const page = new Pagination(
embeds, //Send MessageEmbed Array
"Page",//Footer Text(Default: ページ), Display example 'ページ1/3'
1000 * 30, //Button timeout(Default: 1000*60(1 minute))
//The ButtonOption Class Array
)
ButtonOption Class
{
emoji: "🔙",//Default: ◀️, ⏹, ▶
label: "Prev",//Default: None
style: "SUCCESS"//Default: "PRIMARY"(Prev, Next), "SECONDARY"(Stop)
}
Pagination Class Methods
- sendTo
Send paginationpage.sendTo( message.channel, //TextChannel or DMChannel message.author //UserResolvable of the user who can click button )
- addPage
Add embed to Paginationconst emb = new MessageEmbed().setTitle("Demo Page 4") page.addPage(emb);//return Pagination
- addPage
Add multiple embeds to Paginationconst emb = new MessageEmbed().setTitle("Demo Page 4") const emb2 = new MessageEmbed().setTitle("Demo Page 5") page.addPages([emb, emb3]);//return Pagination
- splicePages
Splice Embedpage.splicePages( 0, //start number 1 //deletecount ) //return page.pages