Aligned fields in embed

Hello ! I'm trying to align 4 fields of an Embed ( like a 2x2 matrix, 2 fields above 2 fields ), I did something like this :
const scoreboard = new EmbedBuilder()
.setColor(colorInfo)
.setDescription(`**Tableau des scores**`)
.addFields(
{name: `${teamNames[0]}`, value: `${teamScores[0]}`, inline: true},
{name: `${teamNames[1]}`, value: `${teamScores[1]}`, inline: true},
{name: `${teamNames[2]}`, value: `${teamScores[2]}`, inline: true},
{name: `${teamNames[3]}`, value: `${teamScores[3]}`, inline: true}
);
const scoreboard = new EmbedBuilder()
.setColor(colorInfo)
.setDescription(`**Tableau des scores**`)
.addFields(
{name: `${teamNames[0]}`, value: `${teamScores[0]}`, inline: true},
{name: `${teamNames[1]}`, value: `${teamScores[1]}`, inline: true},
{name: `${teamNames[2]}`, value: `${teamScores[2]}`, inline: true},
{name: `${teamNames[3]}`, value: `${teamScores[3]}`, inline: true}
);
But I get a bad result ( see attached screenshot ), I tried to put some inline: false to see what it does but I can't manage to align these 4 fields. Thank you in advance :)
No description
8 Replies
d.js toolkit
d.js toolkit3d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
I am BennJ
I am BennJOP3d ago
[email protected] /home/bennj/cur-bot └── [email protected] node: v22.12.0
NyR
NyR3d ago
That's how embeds work on discord, 3 fields inline. You can put zero width characters as 3rd fields name and value, but that'll still look weird to some extent
I am BennJ
I am BennJOP3d ago
Yes but I want my 4 fields to be aligned on 2 levels, in this example, NOC should be under CUR and TTK should be under LGC, 2 fields per level
Sourceae
Sourceae3d ago
your 3rd field must be an empty one with invisible characters so the 4th (NOC) will go to the 2nd row
I am BennJ
I am BennJOP3d ago
This is fine but now there is a space between NOC and TTK that there is not between CUR and LGC with this code
const scoreboard = new EmbedBuilder()
.setColor(colorInfo)
.setDescription(`**Tableau des scores**`)
.addFields(
{name: `${teamNames[0]}`, value: `${teamScores[0]}`, inline: true},
{name: `${teamNames[1]}`, value: `${teamScores[1]}`, inline: true},
{name: `\u200B`, value: `\u200B`, inline: true},
{name: `${teamNames[2]}`, value: `${teamScores[2]}`, inline: true},
{name: `${teamNames[3]}`, value: `${teamScores[3]}`, inline: true}
);
const scoreboard = new EmbedBuilder()
.setColor(colorInfo)
.setDescription(`**Tableau des scores**`)
.addFields(
{name: `${teamNames[0]}`, value: `${teamScores[0]}`, inline: true},
{name: `${teamNames[1]}`, value: `${teamScores[1]}`, inline: true},
{name: `\u200B`, value: `\u200B`, inline: true},
{name: `${teamNames[2]}`, value: `${teamScores[2]}`, inline: true},
{name: `${teamNames[3]}`, value: `${teamScores[3]}`, inline: true}
);
No description
NyR
NyR3d ago
Pass another empty field after TTK
I am BennJ
I am BennJOP3d ago
Thanks a lot !
Want results from more Discord servers?
Add your server