Module djs13-legacy - v2.0.4


logo

npm-version npm-downloads github-issues

📚 About package:

Simple yet powerful module to create customizable embed pages with buttons. Works with Discord.JS starting from v13.

This package supports creation of custom buttons with custom scripts through a simple API.

Advantages:

  • Object-oriented.
  • Predictable.
  • Fast.
  • Customizable.

📥 Installation:

Requires Node.js 16.6.0 or newer (because of Discord.JS).

npm install djs-button-pages
yarn add djs-button-pages
pnpm add djs-button-pages

📃 Examples:

Basic example (previous page and next page buttons):

const {MessageEmbed, Client, MessageButton, Intents} = require('discord.js');
const {ChannelPagination, NextPageButton, PreviousPageButton} = require("djs-button-pages");

const embeds =
[
new MessageEmbed().setDescription("1!"),
new MessageEmbed().setDescription("2"),
new MessageEmbed().setDescription("3"),
new MessageEmbed().setDescription("4"),
new MessageEmbed().setDescription("5"),
new MessageEmbed().setDescription("6"),
new MessageEmbed().setDescription("7"),
new MessageEmbed().setDescription("8"),
]

const buttons =
[
new PreviousPageButton(new MessageButton().setCustomId("prev").setLabel("Previous").setStyle("PRIMARY")),
new NextPageButton(new MessageButton().setCustomId("next").setLabel("Next").setStyle("PRIMARY")),
]

const client = new Client({intents: [Intents.FLAGS.GUILD, Intents.FLAGS.GUILD_MESSAGES]});

client.login("YOUR TOKEN");

client.once("ready", async () => {
console.log("ready");
});

client.on("messageCreate", async (message) => {
if (message.content === "!pages")
{
const pagination = await new ChannelPagination() //Create pagination.
.setButtons(buttons) //Pass buttons.
.setEmbeds(embeds) //Pass embeds.
.setTime(60000) //Set life-time to 60000.
.send(message.channel); //Send.
};
});

More complicated and interesting examples with commentary can be found at GitHub page. There is also documentation that you can read for more information.

❔ Links:

🐛 Bug reporting

For bug-reporting look for GitHub Issues.

Or you can DM me in Discord: moony#6815.

© License:

Copyright © 2022 Danila Kononov (nickname: moony). All rights reserved.

Licensed under the Apache License, Version 2.0.

Index

Enumerations

Classes

Interfaces

Type Aliases

Generated using TypeDoc