Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
Why doesn't my welcome message work(discord.js)

Im trying to make a bot that gives a user member role and sends a simple welcome message to the chat. However when someone joins nothing happens(not even an error). Here is my code:

client.on('guildMemberAdd', guildMember => {
        console.log(guildMember);
        let role = guildMember.guild.roles.cache.find(role => role.name == 'member');
        guildMember.roles.add(role);
    
        member.guild.channels.get('channelID').send(`welcome <@${guildMember.id}> dont forget to 
        check the rules`);
    });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Did you activate the necessary flags ? A client needs the following intent in order to get alerted when someone joins a server the bot is in

const client = new Discord.Client({intents : ["GUILD_MEMBERS"]})

See more intents in the official documentation

In the end, it would look something like :

const Discord = require('discord.js')
const client = new Discord.Client({intents : ["GUILD_MEMBERS"]})

client.on('guildMemberAdd', guildMember => {
        console.log(guildMember);
        let role = guildMember.guild.roles.cache.find(role => role.name == 'member');
        guildMember.roles.add(role.id);
    
        guildMember.guild.channels.get('the channel id')).send(`welcome <@${guildMember.id}> dont forget to 
        check the rules`);
    });

Also make sure you didn't put the client.on('guildMemberAdd',...) inside the client.on('message',..) They need to be separated.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!