How to send the image inside the embed?

The image is sent outside the embed as a regular attachment
3 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Leo.
Leo.10mo ago
Leo.
Leo.10mo ago
async function sendProfileImage(user, profile) {
const attachment = new AttachmentBuilder(profile.url, 'profile.png');

const embed = new EmbedBuilder()
.setColor('Blurple')
.setAuthor({ name: `${user.username}'s profile`, iconURL: user.displayAvatarURL({ dynamic: true }) })
.setImage('attachment://profile.png');

await profileLogger.send({
username: user.username,
avatarURL: user.displayAvatarURL({ dynamic: true }),
embeds: [embed],
files: [attachment]
});
}
async function sendProfileImage(user, profile) {
const attachment = new AttachmentBuilder(profile.url, 'profile.png');

const embed = new EmbedBuilder()
.setColor('Blurple')
.setAuthor({ name: `${user.username}'s profile`, iconURL: user.displayAvatarURL({ dynamic: true }) })
.setImage('attachment://profile.png');

await profileLogger.send({
username: user.username,
avatarURL: user.displayAvatarURL({ dynamic: true }),
embeds: [embed],
files: [attachment]
});
}
I found the solution