Discord Bot 嵌入消息

时间:2021-05-23 17:17:42

标签: javascript node.js discord.js bots

我需要在 embed msg 的右侧添加机器人的图像。

if (message.includes('help')) {

msg.channel.send({
  embed: {
    title: "xxxxxx",
    color: 3447003,
    description:"Enter **agjgj** to know \n\n Enter **jfjk** for \n\n Enter **ufuy** to get"
  }
});

}

还有如何在此代码中标记用户。

1 个答案:

答案 0 :(得分:0)

您可以在嵌入后的下一条消息中标记用户。 msg.channel.send(message.author.toString())

并在嵌入中添加缩略图(右侧图像):

embed: {
    title: "xxxxxx",
    color: 3447003,
    description:"asdasd",
    thumbnail: {
        url: "https://asd.com/asd.png"
    } 
  }

要将服务器上托管的文件用作缩略图:

const file = new Discord.MessageAttachment('./asd.png');
message.channel.send({files: [file], 
    embed: {
        title: "xxxxxx",
        color: 3447003,
        description:"asdasd",
        thumbnail: {
            url: 'attachment://asd.png',
        }
    }
});