0

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?
  • 2
    See if this answers your question, https://stackoverflow.com/questions/64739350/discord-js-bot-welcomes-member-assign-a-role-and-send-them-a-dm/64739684#64739684 – Worthy Alpaca Nov 10 '20 at 11:32
  • A small but helpful tip, you can just use `${member}` instead of mentioning with the ID because `member` is a guildMember that you can mention – Coder Tavi Nov 10 '20 at 21:52
  • Does this answer your question? [Discord.js Bot Welcomes Member, Assign a Role and send them a DM](https://stackoverflow.com/questions/64739350/discord-js-bot-welcomes-member-assign-a-role-and-send-them-a-dm) – Sandeep Nov 11 '20 at 06:19
  • Does this answer your question? [None of my discord.js guildmember events are emitting, my user caches are basically empty, and my functions are timing out?](https://stackoverflow.com/questions/64559390/none-of-my-discord-js-guildmember-events-are-emitting-my-user-caches-are-basica) – Lauren Yim Nov 13 '20 at 01:13

1 Answers1

0

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

Strike Eagle
  • 852
  • 5
  • 19