Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eugabrielsilva/djs-paginate
Simpler discord.js v13 embed pagination tool
https://github.com/eugabrielsilva/djs-paginate
discord discord-embed discord-js
Last synced: 21 days ago
JSON representation
Simpler discord.js v13 embed pagination tool
- Host: GitHub
- URL: https://github.com/eugabrielsilva/djs-paginate
- Owner: eugabrielsilva
- License: mit
- Created: 2022-01-03T15:49:39.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-23T14:20:48.000Z (about 2 years ago)
- Last Synced: 2024-12-17T10:12:07.406Z (about 2 months ago)
- Topics: discord, discord-embed, discord-js
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@eugabrielsilva/djs-paginate
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# djs-paginate
Simpler discord.js v13 embed pagination tool inspired by [discordjs-button-pagination](https://github.com/ryzyx/discordjs-button-pagination).### Installation
```
npm install @eugabrielsilva/djs-paginate
```### Usage
```js
// Import the module
const paginate = require('@eugabrielsilva/djs-paginate');// Create your embed pages
const { MessageEmbed } = require('discord.js');let page1 = new MessageEmbed({
title: 'Page 1',
description: 'This is the first page'
});let page2 = new MessageEmbed({
title: 'Page 2',
description: 'This is the second page'
});// Create an array with your pages
let pages = [page1, page2];// Call the paginate() method passing the message object (from client messageCreate event) and the pages array
paginate(message, pages);
```### Options
The third argument to the `paginate()` function is an object with one or more of the following parameters:|Parameter|Description|Type|Default|
|---|---|---|---|
|timeout|Time (in seconds) to disable the paginator collector after no interactions are received.|`int`|`60`
|prevText|Text to show in the previous button.|`string`|`"⏪ Anterior"`
|nextText|Text to show in the next button.|`string`|`"Próxima ⏩"`
|pageText|Text to show before the page counter.|`string`|`"📄 Página"`
|pageSeparator|Text to show between the page counter.|`string`|`"/"`_Example:_
```js
paginate(message, pages, {
timeout: 120,
prevText: 'Previous',
nextText: 'Next',
pageText: 'Page',
separatorText: 'from'
});
```### Credits
Library developed and currently maintained by [Gabriel Silva](https://github.com/eugabrielsilva).\
Special thanks to [ryzyx](https://github.com/ryzyx) for the original idea.