Discord.js嵌入式消息多行值 [英] Discord.js Embedded message multiple line value

查看:40
本文介绍了Discord.js嵌入式消息多行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发送嵌入消息的标准方法是:

  message.channel.send({embed:{
颜色:3447003,
标题: Test:,
字段:[
{名称: Test 1,value = Test},
{名称:测试2,值: TEST},
{名称:测试3,值: TEST}
]
}
});

我想知道是否有任何方法可以使消息以块形式出现,例如:

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

我的目标是使其内联,您可以为每个标题输入多个值。首先,我认为 \n 可以解决问题,但不起作用。我尝试了其他一些尝试,例如尝试向其中添加embed-manager.js,但它也无法正常工作。

  message.channel.send({embed:{
color:3447003,
title: Test ::,
字段:[
{名称: Test 1,value = Test1 \n Test2 \n Test3}},
{名称: Test 2,值: TEST},
{名称: Test 3,值: TEST}
]
}
});

我的目标是这样的:


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.

解决方案

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:

这篇关于Discord.js嵌入式消息多行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆