CalebDicks
CalebDicks

Reputation: 39

Is there a way that i can fix my server greeting?

While creating the server greeting for my discord bot and following along with a youtube video i created this part of code for my bot.

I save and run the code and it does not replace ${member} with the username of the joining member to welcome them into the server.

I've tried changing ${member} to the following:

${Member} and @{member}

bot.on('guildMemberAdd', member => {

      const channel = member.guild.channels.find(channel => channel.name === "welcome");
      if(!channel) return;

      channel.send('Welcome to our server, ${member}, Read our server rules / introduce yourself and get comfortable! We thank you for joining our server.')

I Expected : Welcome to our server, @JohnDoe, Read our server rules / introduce yourself and get comfortable! We thank you for joining our server.

Actual Output : Welcome to our server, ${member}, Read our server rules / introduce yourself and get comfortable! We thank you for joining our server.

Upvotes: 2

Views: 64

Answers (1)

rodrigoap
rodrigoap

Reputation: 7480

Use back-ticks/grave accents (`) instead of quotes, like this:

`Welcome to our server, ${member}, Read our server rules / introduce yourself and get comfortable! We thank you for joining our server.`

More about template literals.

Upvotes: 1

Related Questions