code to console log members joining isnt working in discord.js

I have been half following a tutorial, half working it out on my own how to code a discord bot in discord.js. I am up to the point where i want to add a welcome message, and after doing the same thing as the person making the tutorial the code isn’t console logging a joining member to the server. Here is the code that i have done, and in the tutorial the code would send a welcome message to the selected channel and console log the member.

there is no error message

module.exports = client => {
    const channelId = '790887807127650304' // welcome channel
    
    client.on('guildMemberAdd', member => {
        console.log(member)

        const message =  `welcome <@${member.id} to the server!`

        const channel = member.guild.channels.cache.get(channelID)
        channel.send(message)
    })
}

also, for reference, here is the tutorial i have been following;
video

28 thoughts on “code to console log members joining isnt working in discord.js”

Leave a Comment