Module djs14-legacy - v2.1.3


logo

npm-version npm-downloads github-issues

📚 About package:

Simple yet powerful module to create fully-customizable embed pages with buttons. Works with Discord.JS. Supports v13 and v14.

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.9.0 or newer (because of Discord.JS).

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

For v13 (requires Node.js 16.6.0 or newer):

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

📃 Examples:

Basic example (previous page and next page buttons):

const { Client, EmbedBuilder, ButtonStyle, IntentsBitField } = require("discord.js");
const { ChannelPagination, NextPageButton, PreviousPageButton } = require("djs-button-pages");

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

const buttons =
[
new PreviousPageButton({custom_id: "prev_page", label: "Previous", style: ButtonStyle.Success}),
new NextPageButton().setStyle({custom_id: "next_page", label: "Next", style: ButtonStyle.Success}),
];

//These very bitfields are needed for this example.
const client = new Client({intents: [IntentsBitField.Flags.GuildMessages, IntentsBitField.Flags.Guilds, IntentsBitField.Flags.MessageContent]});

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

client.on("messageCreate", async (message) => {
if (message.content === "!pages")
{
const pagination = new ChannelPagination() //Create pagination.
.setButtons(buttons) //Insert buttons.
.setEmbeds(embeds) //Add embeds.
.setTime(60000); //Set time.

await pagination.send(message.channel); //Send!
};
});

//Login.
client.login("YOUR TOKEN");

More complicated and interesting examples with commentary may be found at GitHub page.

❔ 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

Functions

Generated using TypeDoc