I’m working on a Discord bot written in Node.js and trying to figure out how to show a user’s profile picture when they join the server. Someone helped me create the bot but I need to add this feature myself.
Here’s my current welcome message code:
"embed": {
"color": 16711680,
"thumbnail": {
"url": "https://example-image-url.com"
},
"description": `**Welcome ${user.username}! Great to have you here!**`,
}
I found that user.displayAvatarURL might work but when I tried it, it only shows the URL as text instead of displaying the actual image. How do I make the avatar picture appear in the embed instead of just showing the link?
Had the same issue building my first bot a few months back. Yeah, it’s the missing parentheses, but you should also check if the user actually has an avatar. Some people just use Discord’s defaults. Try user.displayAvatarURL({ dynamic: true, format: 'png' }) as a fallback - it handles both cases. If you’re on an older discord.js version, the method might be different. I had to update mine to get it working. Once you call it as a proper function, the avatar should show up in your thumbnail.
This happens because you’re not calling displayAvatarURL() as a function - you’re missing the parentheses.
Update your embed code like this:
"embed": {
"color": 16711680,
"thumbnail": {
"url": user.displayAvatarURL({ dynamic: true, size: 256 })
},
"description": `**Welcome ${user.username}! Great to have you here!**`,
}
The dynamic: true shows animated avatars properly, and size: 256 gives better quality. I made this exact mistake when I started with Discord.js - forgetting those parentheses trips up tons of people.
yep, dont forget those parentheses! also, keep an eye on your discord.js version - some old ones work different. just use user.displayAvatarURL() in th thumbnail field and u should be good!