Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrzillagold/discord.js-pages

📦 Dynamic pages pagination module for discord.js
https://github.com/mrzillagold/discord.js-pages

discord discordjs pages pagination

Last synced: 3 months ago
JSON representation

📦 Dynamic pages pagination module for discord.js

Awesome Lists containing this project

README

        


discord.js-pages



📦 Dynamic pages pagination module for discord.js





npm version

| 📖 [Documentation](https://mrzillagold.github.io/discord.js-pages/index.html) | [🤖 Examples](https://github.com/MrZillaGold/discord.js-pages/tree/master/examples) |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|

### Install 📦
`npm i discord.js-pages`

### Usage 📦
```js
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);
```

### Demo 🎥