gpt4 book ai didi

discord - 在嵌入字段中发送附件

转载 作者:行者123 更新时间:2023-12-04 03:04:45 25 4
gpt4 key购买 nike

我正在使用 discord.js,我试图让我的机器人在嵌入字段中发送附件。我已经试过了,但没用:

message.channel.send({embed: {
files: [ "images/twitter.png" ]
}});

我也试过了,还是不行:

message.channel.send({embed: {}, files: [ "images/twitter.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 - 在嵌入字段中发送附件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45622168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com