在嵌入字段中发送附件
Sending attachments in embed field
我正在与 discord.js 合作,我试图让我的机器人在嵌入字段中发送附件。我试过了,但没用:
message.channel.send({embed: {
files: [ "images/twitter.png" ]
}});
我也试过了,还是不行:
message.channel.send({embed: {}, files: [ "images/twitter.png" ]}});
如有任何帮助,我们将不胜感激!
我最好的猜测是在我看到的指南的底部。
应该是这样的:
.setThumbnail("http://i.imgur.com/p2qNFag.png")
希望这对你需要做的有用。
This similar post 可能会有帮助。发送附件需要 2 个步骤。
将附件添加到您的邮件中:
files: [{ attachment: 'images/twitter.png', name: 'twitter.png' }]
然后将附件添加到您的嵌入中:
image: { url: "attachment://twitter.png" }
完整示例:
message.channel.send({
embed: {
description: "This is some text",
image: {
url: "attachment://twitter.png"
}
},
files: [{
attachment: 'images/twitter.png',
name: 'twitter.png'
}]
});
我正在与 discord.js 合作,我试图让我的机器人在嵌入字段中发送附件。我试过了,但没用:
message.channel.send({embed: {
files: [ "images/twitter.png" ]
}});
我也试过了,还是不行:
message.channel.send({embed: {}, files: [ "images/twitter.png" ]}});
如有任何帮助,我们将不胜感激!
我最好的猜测是在我看到的指南的底部。
应该是这样的:
.setThumbnail("http://i.imgur.com/p2qNFag.png")
希望这对你需要做的有用。
This similar post 可能会有帮助。发送附件需要 2 个步骤。
将附件添加到您的邮件中:
files: [{ attachment: 'images/twitter.png', name: 'twitter.png' }]
然后将附件添加到您的嵌入中:
image: { url: "attachment://twitter.png" }
完整示例:
message.channel.send({
embed: {
description: "This is some text",
image: {
url: "attachment://twitter.png"
}
},
files: [{
attachment: 'images/twitter.png',
name: 'twitter.png'
}]
});