0
votes

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?
1
See if this answers your question, stackoverflow.com/questions/64739350/…Worthy Alpaca
A small but helpful tip, you can just use ${member} instead of mentioning with the ID because member is a guildMember that you can mentionCoder Tavi

1 Answers

0
votes

This is most likely a privileged intents problem, which recently became required. Check out this question to see if it solves it. Also read the discord API docs for privileged intents