Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
181 views
in Technique[技术] by (71.8m points)

javascript - 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

question from:https://stackoverflow.com/questions/65873748/how-can-i-make-my-embeds-more-cleaner-in-discord-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to fix your .addField to :

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...