1.0.1 • Published 3 years ago

embed-navigator v1.0.1

Weekly downloads
3
License
ISC
Repository
-
Last release
3 years ago

A simple tool which allows you to split your Discord.js MessageEmbed for a best experience.


Installation

npm install --save embed-navigator

Use

const embedNavigator = require('embed-navigator');
const {Client} = require('discord.js');
const bot = new Client();

bot.login('token');

/* For example, on Discord.js Client's ready event */

bot.on('ready' () => {
    const channel = bot.channels.cache.get('144861334608150528');

    const embeds = [
        new MessageEmbed().setTitle('TEST - 1').setDescription('ALL WORKS'),
        new MessageEmbed().setTitle('TEST - 2').setDescription('ALL WORKS'),
        new MessageEmbed().setTitle('TEST - 3').setDescription('ALL WORKS'),
        new MessageEmbed().setTitle('TEST - 4').setDescription('ALL WORKS'),
    ];

    const duration = 60000;

    embedNavigator(channel, embeds, duration);
})

/* Or the message event */

bot.on('message', message => {
    const channel = message.channel;

    const embeds = [
        new MessageEmbed().setTitle('TEST - 1').setDescription('ALL WORKS'),
        new MessageEmbed().setTitle('TEST - 2').setDescription('ALL WORKS'),
        new MessageEmbed().setTitle('TEST - 3').setDescription('ALL WORKS'),
        new MessageEmbed().setTitle('TEST - 4').setDescription('ALL WORKS'),
    ];

    const duration = 60000;

    embedNavigator(channel, embeds, duration);

})

/**
 * @param {TextChannel} channel - The target channel of your embed navigator
 * @param {MessageEmbed[]} embeds - Your stack of embeds to send 
 * @param {number} duration - Navigation life-time in ms
 * */