discord.js-pages
v1.4.4
Published
Dynamic pages pagination module for discord.js
Downloads
35
Maintainers
Readme
| 📖 Documentation | 🤖 Examples | |-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Install 📦
npm i discord.js-pages
Usage 📦
import { PagesBuilder, PagesManager } from 'discord.js-pages';
import { Client, EmbedBuilder } from 'discord.js';
const client = new Client({
intents: [
'Guilds'
]
});
const pagesManager = new PagesManager();
// Middleware is useful in bots with modular commands
client.on('interactionCreate', (interaction) => {
if (!interaction.isCommand()) {
return;
}
pagesManager.middleware(interaction);
interaction.pagesBuilder()
.setTitle('Global title')
.setPages([
new EmbedBuilder()
.setDescription('First page'),
new EmbedBuilder()
.setDescription('Second page')
])
.addFields([
{
name: 'Global field',
value: 'discord.js-pages',
inline: true
}
])
.setColor('Green')
.setPaginationFormat()
.build();
});
// Also you can create PagesBuilder instance directly
client.on('interactionCreate', (interaction) => {
if (!interaction.isCommand()) {
return;
}
new PagesBuilder(interaction)
.setTitle('Global title')
.setPages([
new EmbedBuilder()
.setDescription('First page'),
new EmbedBuilder()
.setDescription('Second page')
])
.addFields([
{
name: 'Global field',
value: 'discord.js-pages',
inline: true
}
])
.setColor('Green')
.build();
});
client.login(process.env.TOKEN);