Is there a way to format text in embeds using discord.js?

Viewed 8545

I'm kinda new to coding discord bots using discord.js and I was wondering if I could format the text in embeds. I can't find the way of doing it, as I have the value of the field in between these symbols ´ to make it possible to go on multiple lines and I would like the text to be code formatted (example in the attachment).

My code looks like this and I would like for example the "line 1" text to be the code format:

execute(message, args){
        const embed = new Discord.MessageEmbed()
        .setTitle('Commands list')
        .setColor('#DAF7A6')
        .addFields(
            {name: 'Test 1',
            value:`line 1
            line 2
            line 3`}
        )
        message.channel.send(embed);
      }

Thanks :) enter image description here

1 Answers

Use double ". Like: "`Your name`".

If you want to have multiple lines, use \n, it's the markdown alias for the back to line stuff.

So in your example:

execute(message, args){
        const embed = new Discord.MessageEmbed()
        .setTitle('Commands list')
        .setColor('#DAF7A6')
        .addFields(
            {name: 'Test 1',
            value:"`line 1`\n`line 2`\n`line 3`"}
        )
        message.channel.send(embed);
      }
Related