EasyEmbedPages
A fully customizable and module for easy interactive discord embeds with dynamic pages!
This module is used to make hassle-free embeds with different pages... This module is fully customizable and each property of each page can be changed!
The description of the embed gets dynamically carried over to a different page if it exceed 2000 characters
Note: works only with discord.js 12
Installation
npm i easy-embed-pages
Usage
const EasyEmbedPages = require('easy-embed-pages');
Examples
Basic simple usage
Note: Content greater than 2000 characters gets transferred to the next embed page!
const embed = new EasyEmbedPages(message.channel, {
color: '#ff00ff',
url:'https://example.com',
title: "Simple Embed",
description: "insert long text here"
});
embed.start();
Using custom fields and other things for each page
Note: If you specify pages in pages which are more than the dynamic content pages, they will be added as extra pages!
const embed = new EasyEmbedPages(message.channel, {
pages: [
{
fields: [
{
name: "Custom field yay!",
value: "Yikes... I love this module!",
inline: false
}
]
},
{
title: "This page has a custom title!",
description: "And a custom description field too!"
}
],
color: '#ff00ff',
url: 'https://example.com',
title: "Simple Embed",
description: "insert long text here"
});
embed.start();
Using premade embeds
Note: You can use you premade Discord#MessageEmbed this way
const embed = new EasyEmbedPages(message.channel, {
pages: [
myEmbed1.toJSON(),
myEmbed2.toJSON()
],
});
embed.start();
Advanced Usage
Full cranked up usage!
const embed = new EasyEmbedPages(message.channel, {
pages: [
{
title: "Hello World!",
color: "#00ffff",
author: {
name: "Jaguar"
}
},
{
fields: [
{
name: "My field",
value: "My value",
inline: true
}
],
thumbnail: "https://example.com/my_other_image.png"
}
],
color: 'RANDOM',
url: "https://example.com",
title: "This is a test embed",
author: {
name: "Jaguar"
},
footer: {
text: "Insert Footer Text Here"
},
description: "Insert long text here",
image: "https://example.com/your_large_image.png",
thumbnail: "https://example.com/your_small_thumbnail.png",
allowStop: true,
time: 300000,
ratelimit: 1500
},
(embed) => {
if(embed.description) embed.setDescription(`\`\`\`\n${embed.description}\n\`\`\``)
});
embed.start({
channel: message.channel,
person: message.author
});
Example Eval Command!
const EasyEmbedPages = require('easy-embed-pages');
async function run(client, message, args) {
const clean = text => ((typeof text === "string") ? text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)) : text);
let output;
let status = true;
try {
let evaled = eval(args.join(' '));
if (evaled instanceof Promise) evaled = await evaled;
else if (typeof evaled !== "string") evaled = require("util").inspect(evaled);
output = clean(evaled).replace(new RegExp(client.token, 'g'), '[TOKEN REMOVED]');
} catch (err) {
status = false;
output = err.toString();
}
const embed = new EasyEmbedPages(
message.channel,
{
color: status ? 'GREEN' : 'RED',
title: "Eval response",
description: output
},
(embed) => {
if(embed.description) embed.setDescription(`\`\`\`xl\n${embed.description}\n\`\`\``)
}
);
embed.start({ user: message.author });
}