Mentions and/or usernames in embeds

I cant get the embed welome message to return the joining members username. I have tried many ways.
const WelcomeEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setDescription('Welcome! <@${user.id}> We are happy to see you join!');
const WelcomeEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setDescription('Welcome! <@${user.id}> We are happy to see you join!');
10 Replies
d.js toolkit
d.js toolkit13mo 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! - Marked as resolved by staff
treble/luna
treble/luna13mo ago
show your full code and the result
FrankFromH
FrankFromHOP13mo ago
client.on('guildMemberAdd', (member) => {

const channelId = '1180601301801910372';
const channel = client.channels.cache.get(channelId);
console.log(member)

if (channel) {

const WelcomeEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setDescription('Welcome! <@${user.id}> We are happy to see you join! You are member ${member.guild.memberCount} of the community!\n\nIn order to start posting and see all of our channels you must visit: RULES and react to the post to be elevated to a hatchling. Once you have completed that you must go to: LINK and follow the steps. This will link your account and allow you to use all features available, such as nesting. And you will now be a juvenile. Check out our ROLES to get roles to notify you of server activities.\n\n\nThank you, we cant wait to see you in the game!')
.setThumbnail(member.user.avatarURL());


channel.send({ embeds: [WelcomeEmbed] } );

} else {
console.error('Channel not found.');
}
});
client.on('guildMemberAdd', (member) => {

const channelId = '1180601301801910372';
const channel = client.channels.cache.get(channelId);
console.log(member)

if (channel) {

const WelcomeEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setDescription('Welcome! <@${user.id}> We are happy to see you join! You are member ${member.guild.memberCount} of the community!\n\nIn order to start posting and see all of our channels you must visit: RULES and react to the post to be elevated to a hatchling. Once you have completed that you must go to: LINK and follow the steps. This will link your account and allow you to use all features available, such as nesting. And you will now be a juvenile. Check out our ROLES to get roles to notify you of server activities.\n\n\nThank you, we cant wait to see you in the game!')
.setThumbnail(member.user.avatarURL());


channel.send({ embeds: [WelcomeEmbed] } );

} else {
console.error('Channel not found.');
}
});
The result looks identical as the .setdescription text. Nothing changes. My member count also does not work.
treble/luna
treble/luna13mo ago
you use user but never define it
FrankFromH
FrankFromHOP13mo ago
clearly i am missing something. Thats why i am here. I am new to this, how do i define the user, i did not have to define the member.user.avatarURL. And i am assuming that means some sort of defining the membercount as well?
treble/luna
treble/luna13mo ago
you really should know how to define stuff its basic js
FrankFromH
FrankFromHOP13mo ago
Thank for the help. Glad this is a place to get help when asking humbly.
Ashish
Ashish13mo ago
1. You are using single quotes (') instead of backticks (). You need to use backticks if you want to use template literals (which allow you to use variables inside your string) 2. As wolvinny said, user is not defined. To get a user's ID, you can do member.id` 3. Notice how this forum channel name is djs-questions and not js-questions? That's because your issue is NOT related to discord.js, but more to Javascript.... If you have problems with Javascript in the future, please use #other-js-ts
FrankFromH
FrankFromHOP13mo ago
Thank you I wanted to thank you again. I’m learning. How to do stuff on my own and your answer was far more helpful. I will make sure I post in the right area I didn’t really.s it was the wrong area. I was able to fix it with your help and it’s working as it should.
Ashish
Ashish13mo ago
No problems!
Want results from more Discord servers?
Add your server