Discord.js Use Attachment From Other Message To Update Image In Embed
I am generating a Picture from a Canvas (it's in imageBuffer), and making a MessageAttachment from it: const attachment = new MessageAttachment(imageBuffer, 'bufferedImg.png'); I
Solution 1:
To achieve this using the latest discordjs (13.0.1) (Typescript):
1. Create & Send the first message which you want to update.
let embed = new MessageEmbed().setImage(INSERT_YOUR_FIRST_URL)
const displayMessage = await channel.send({ embeds: [embed] })
2. Send the second message & Get the URL. you can send it to a different channel or server if you want to keep the channel clean
const msg = await channel.send({ files: [attachment] })
const url = msg.attachments.first()?.url ?? '';
3. Edit your first message.
embed = newMessageEmbed().setImage(url)
displayMessage.edit({ embeds: [embed] })
Post a Comment for "Discord.js Use Attachment From Other Message To Update Image In Embed"