I’m developing a Discord bot with Node.js, and I could use some assistance. I want to include the profile picture of new members in the welcome message embed when they join the server.
Here’s what my current welcome embed looks like:
"embed": {
"color": 3447003,
"thumbnail": {
"url": "https://example-image-url.com"
},
"description": `Welcome to our community, ${user.username}! We are glad you're here!`,
}
I attempted to use user.displayAvatarURL, but it only outputs the URL as plain text, not the actual avatar image in the embed. How can I correctly set the user’s avatar picture for the welcome embed? I’m still learning about Discord bot development, so any guidance would be greatly appreciated.
You’re hardcoding the thumbnail URL instead of using the user’s avatar. Just replace your thumbnail section with "thumbnail": { "url": user.displayAvatarURL() } and ditch the static URL. This’ll grab each member’s profile picture when they join. Make sure you add the parentheses to displayAvatarURL() - that’s probably why you saw text instead of an image. I’ve used this method for months and it works great across different servers.
This is a common issue when you’re starting with Discord.js embeds. Make sure you’re calling displayAvatarURL() with parentheses—they’re crucial here. Your thumbnail setup looks good, but try user.displayAvatarURL({ dynamic: true, size: 256 }) for better quality. This handles animated avatars and gives you decent resolution. Also check that your user object is properly defined where you’re creating the embed. Sometimes avatars don’t show because of permission issues or the user doesn’t have a custom avatar set—Discord just falls back to the default one.
u can switch thumbnail to author and use the avatar URL there. try this: "author": { "name": user.username, "icon_url": user.displayAvatarURL() } - this worked for me and looked pretty good.