Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discord.js Embedded message multiple line value

The standard way of sending an embedded message is:

message.channel.send({embed: {
      color: 3447003,
      title: "Test:",
      fields: [
        { name: "Test 1", value="Test"},
        { name: "Test 2", value: "TEST"},
        { name: "Test 3", value: "TEST"}
      ]
    }
  });

I was wondering if there is any way I could make the messages in block form for example:

Test1:                    Test2:
test1                     test1
test2                     test2
test3                     test3
test4                     test4

I'm aiming so it goes inline and you can input multiple values/per title. First I thought that \n would do the trick but it doesn't work. I tried some other things as trying to add a embed-manager.js to it but it doesn't work aswell.

message.channel.send({embed: {
      color: 3447003,
      title: "Test:",
      fields: [
        { name: "Test 1", value="Test1 \n Test2 \n Test3"},
        { name: "Test 2", value: "TEST"},
        { name: "Test 3", value: "TEST"}
      ]
    }
  });

I am aiming for something like this: Example picture

Thank you for your help in advance.

like image 522
RageMasterGaming Avatar asked Mar 17 '18 09:03

RageMasterGaming


1 Answers

First you can't use = on objects. It's always :
You can use \n to make a break line.
You can use inline: true so it shows up to 3 fields in one line.

message.channel.send({embed: {
      color: 3447003,
      title: "Test:",
      fields: [
        { name: "Test 1", value: "Line1\nLine2\nLine3", inline: true},
        { name: "Test 2", value: "AlsoLine1\nAlsoLine2\nAndLine3", inline: true}
      ]
    }
  });

This is the result of this code:
Code result

like image 174
André Avatar answered Sep 18 '22 01:09

André