So, my code for making the bot greet new users stopped working, and i have no idea why or how this is the code that im using for the welcome event itself ```module.exports = (client) => { const channelId = '757493821251649608' // welcome channel const targetChannelId = '757521186929246219' // rules and info
client.on('guildMemberAdd', (member) => {
const message = `Hi, hope you enjoy your stay <@${
member.id
}> , Oh i almost forgot to tell you, check out! ${member.guild.channels.cache
.get(targetChannelId)
.toString()}`
const channel = member.guild.channels.cache.get(channelId)
channel.send(message)
})
}```
And this is how i make the bot execute it
const hi = require('./events/hi')
const hello = require('./events/hello')
const yo = require('./events/yo')
const whatsup = require('./events/whatsUp')
const bye = require('./events/bye')
client.once('ready', () =>{
console.log('Aiko is working!');
client.user.setActivity(' your orders!|Prefix is +', { type: "LISTENING" });
hi(client)
hello(client)
yo(client)
whatsup(client)
bye(client)
welcome(client)
});```
The event that should also send a message when someone leaves the server also doesn't go off, anyone any idea why?
${member}
instead of mentioning with the ID becausemember
is a guildMember that you can mention – Coder Tavi