-1

Why is the bot not messaging the user when he joins the server?

bot.on("guildMemberAdd", async (member) => {
    const embed = new Discord.MessageEmbed().setDescription(`Willkommen bei ${colours.mainname}. Wir m`).setColor(colours.maincolour);
    member.send(embed);

    // var role = member.guild.roles.cache.find(role => role.id === '746850263335305316');
    // member.roles.add(role);
});
Jakye
  • 6,440
  • 3
  • 19
  • 38
  • 1
    Please check out this 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). – Jakye Nov 05 '20 at 13:38
  • It doesnt help me... –  Nov 05 '20 at 15:45
  • Did you enable both of the intents? – Lioness100 Nov 05 '20 at 15:58
  • Wdym with intents? –  Nov 05 '20 at 16:05
  • 1
    You said that it didn't help you but looks like you didn't even read the link – Androz2091 Nov 05 '20 at 16:25
  • Now that you already know that intents might be the issue, you should also know that you're not catching the error on the `.send()` method. Some people have their DMs closed and using that send method on them will throw an error. To fix that you need to call catch after it. `.send().catch(err => console.log(err))` – Shubham Parihar Nov 06 '20 at 09:01

1 Answers1

1

As said by Jakye, you now must use intents. On the developer portal, select your project, and under bot tab, you'll need to tick the intents. Note it's more complicated for bots in over 100 guilds, but from what I've seen I don't think you're near that yet. You'll need to opt into intents

Yankue Team
  • 109
  • 1
  • 10