如何在嵌入的不一致中编辑图像? [英] How do I edit an image inside an embed discord?
本文介绍了如何在嵌入的不一致中编辑图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以更改嵌入中的图像?我正试图重现我在Reddit上看到的一个etch-a-sketch&机器人,我想知道它是怎么做到的。以下是我到目前为止尝试过的: 这在制作图像的函数中:
//code that draws the etch-a-sketch
const etchembed = new Discord.MessageEmbed()
.setAuthor(`${message.author.username}`, `${message.author.displayAvatarURL()}`)
.setTitle('🎨 Etch-A-Sketch 🎨')
.setColor("#f66868")
.setFooter(`${client.user.username}`, `${client.user.displayAvatarURL()}`)
//n is a variable that increases by 1 every time the function is run
.attachFiles([new Discord.MessageAttachment(canvas.toBuffer(), `etch${n}.png`)])
.setImage(`attachment://etch${n}.png`)
.setTimestamp();
return etchembed
在主命令文件中,我在等待函数返回后执行此操作:
message.edit(newetchembed)
所做的只是将图像移出嵌入。我做错了什么吗?
编辑1:
我尝试更改消息。编辑(...)发送到Message.Channel.Send(...)它会发送一张新的嵌入图片,而且效果很好。当我尝试使用Message.edit时,由于某种原因,它只是将图像移出嵌入。
编辑2:
我做了更多的测试,我开始认为这只是不一致或不一致的问题。这是因为当我记录文件附件和图像时,一切都正常工作:
embed 1: [
MessageAttachment {
attachment: < Buffer 89 50 4e 47 0 d 0 a 1 a 0 a 00 00 00 0 d 49 48 44 52 00 00 01 94 00 00 01 2 c 08 06 00 00 00 e4 5 c 45 b8 00 00 00 06 62 4 b 47 44 00 ff 00 ff 00 ff a0 bd a7...1167 more bytes > ,
name: 'etch_1595840597644.png'
}
] {
url: 'attachment://etch_1595840597644.png'
}
embed 2: [
MessageAttachment {
attachment: < Buffer 89 50 4e 47 0 d 0 a 1 a 0 a 00 00 00 0 d 49 48 44 52 00 00 01 94 00 00 01 2 c 08 06 00 00 00 e4 5 c 45 b8 00 00 00 06 62 4 b 47 44 00 ff 00 ff 00 ff a0 bd a7...1167 more bytes > ,
name: 'etch_1595840607390.png'
}
] {
url: 'attachment://etch_1595840607390.png'
}
正如您所看到的,消息嵌入具有不同的图像附件,所以我不确定为什么它只将原始图像移到嵌入之外,而不是附加新的图像。This is what it looks like.
另一件事是,当我发送新邮件时,它会发送正确的图像,而不是编辑。
推荐答案
无法编辑邮件的附件-这是不一致的限制。
您必须删除原始邮件并发送带有新附件的新邮件才能做到这一点。
这篇关于如何在嵌入的不一致中编辑图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文