2.0.0-dev.1 • Published 2 years ago

@sheweny/paginator v2.0.0-dev.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Discord embed paginator

This module is a paginator of embeds using discord.js V13 and array-paginator module.

Getting started

Prerequisites

  • Node.js 16.9.0 or newer is required.

  • Discord.js 14.0.0 is required.

Installation

With npm

npm install @discord-util/paginator

With yarn

yarn add @discord-util/paginator

Usage

Create a new instance of the EmbedPaginator class.

Parameters :

  • Channel : The channel of the paginator (type : TextChannel|ThreadChannel)
  • Data : A list of embeds to display (type : Array<MessageEmbed>)
  • Options : The options (type : Options)

Options :

NameTypeDescriptionDefaultRequired
summonerstringThe id of the summonerNoneyes
firstAndLaststringIf the first and last button should be displayNoneyes

Example

const { Client, MessageEmbed } = require("discord.js");
const { EmbedPaginator } = require("@discord-util/paginator");
const embed = new MessageEmbed()
  .setTitle("Hi")
  .setColor("orange")
  .setDescription("Hello");
const embed = new MessageEmbed()
  .setTitle("Hello world")
  .setColor("blue")
  .setDescription("Hello world !");
const data = [embed, embed2];

const client = new Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });
client.on("messageCreate", async (msg) => {
  const args = msg.content.split(" ");
  if (args[0] != "!help") return;
  new EmbedPaginator(msg.channel, data, {
    summoner: msg.member.id,
    maxPerPage: 1,
  });
});
client.login("");