PerplexingParadox
PerplexingParadox

Reputation: 1196

Embed Formatting Inline

The current embed I have looks like this:

myEmbed

However, I want the sections named Total to be in the same line. I'm not sure how you break the inline without the second Total not being in the same line as well.

The result I'm looking for:

exampleEmbed

My current code:

//ignore the card[1], card[0], etc. Those are arrays for what I want to post as emoji's/card values
const embed = new Discord.MessageEmbed()
  .setTitle(`Blackjack`)
  //card[1] = rank; card[0] = suit
  .addFields(
    { name: 'Your Hand', value: `${card[1]}${card[0]}${card3[1]}${card3[0]}`, inline: true },
    { name: "Dealer's Hand", value : `${card2[1]}${card2[0]}`, inline: true },
    { name: "Total: [calculate later]", value: "\u200B" },
    { name: "Total: [to create later]", value: "\u200B", inline: true },
  )
  .setFooter("Commands\n!stand\n!hit\n!double\n!fold\n!split"); 
message.channel.send(embed);

Upvotes: 1

Views: 288

Answers (2)

Zsolt Meszaros
Zsolt Meszaros

Reputation: 23189

I think it would be easier to add the total value in the same column by including it in the hands' value on the next line after the cards. You could also add some extra space between the two columns:

const embed = new MessageEmbed().setTitle(`Blackjack`).addFields(
  {
    name: 'Your Hand',
    value: `A♦2♠7♦\n\nTotal: **10/20**`,
    inline: true,
  },
  {
    name: '\b',
    value: '\b',
    inline: true,
  },
  {
    name: "Dealer's Hand",
    value: `K♦4♣\n\nTotal: **14**`,
    inline: true,
  },
);
message.channel.send(embed);

enter image description here

Upvotes: 1

Elitezen
Elitezen

Reputation: 6730

You need to set both field's inline option to true. Keep in mind that the result may be different on different sized screens

{ name: "Total: [calculate later]", value: "\u200B", inline: true},
{ name: "Total: [to create later]", value: "\u200B", inline: true},

Upvotes: 0

Related Questions