Search code examples
javascriptnode.jsdiscord.jsembed

How can I make my Embeds more Cleaner in Discord.js?


I would like to know how I can make my embeds more look more cleaner. The embed style I am using is like this:

const Discord = require('discord.js');

        const Embed = new Discord.MessageEmbed()
        .setTitle("The Commands")
        .setColor(0xFF0000)
        .addField("Category:", "`something`", true)
        .addField('\u200b', "`something1`", true)
        .addField('\u200b', "`something2`", true)
        .addField('\u200b', "`something3`", true)
        .addField('\u200b', "`something4`", true)
        .addField('\u200b', "`something5`", true)
        .addField('\u200b', "`something6`", true)
        .addField('\u200b', "`something7`", true)
        .addField('\u200b', "`something8`", true)
        .addField("Category 1:", "`something9`", true)
        .addField('\u200b', "`something10`", true)
        .addField('\u200b', "`something11`", true)
        .addField("Category 2", "`something12`", true)
        .addField('\u200b', "`something13`", true)
        .addField('\u200b', "`something14`", true)
        .addField('\u200b', "`something15`", true);

        message.author.send(Embed)
        message.channel.send(`check your dm's for the commands`);

The outcome of this code is: This image is currently unavailable

Here is somewhat closer to what I want the embed to look like: This image is currently unavailable


Solution

  • You need to fix your .addField to :

    .addFields(
    { name: 'Inline field title', value: 'Some value here\n' + 'Some value here\n' + 'Some value here', inline: true },
    { name: 'Inline field title', value: 'Some value here\n' + 'Some value here\n' + 'Some value here', inline: true },
    )