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
776 views
in Technique[技术] by (71.8m points)

node.js - 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 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 
 Test2 
 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.

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

First you can't use = on objects. It's always :
You can use 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
Line2
Line3", inline: true},
        { name: "Test 2", value: "AlsoLine1
AlsoLine2
AndLine3", inline: true}
      ]
    }
  });

This is the result of this code:
Code result


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

...