Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

117
Visualizações
I can't understand why does it not send Discord.js v13

I can't understand why doesn't send the welcome message

Here's Code from index.js

client.on('guildMemberAdd', (member) => {
  let chx = db.get(`welchannel_${member.guild.id}`);
  if (chx === null) {
    return;
  }

  client.channels.cache.get(chx).send(`Welcome to ${message.guild.name}`);
});

Here's Code From channel.js module.exports = {

name: "channel",
  description: "Help Command",
  category: "Help",
  execute(client, message, args, Discord) {
    const db = require("quick.db")

    let channel = message.mentions.channels.first() //mentioned channel
    
    if(!channel) { //if channel is not mentioned
      return message.channel.send("Please Mention the channel first")
    }

    db.set(`welchannel_${message.guild.id}`, channel.id)
    
    const embed = new Discord.MessageEmbed()
        .setColor('#b5b5b5')
        .setTitle(`Channel set: ${channel.name} `)

    message.channel.send({ embeds: [embed] });
  }
}

EDIT: I found out the problem i didn't have a intent flag GUILD_MEMBERS and also thanks UltraX that helped also

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Basically, the reason is simple, you need to go to your dev portal then after choosing your bot/application just go to bot and you need to enable member intents Server Member Intent after that it should work, if it didn't just give it a 10 minute, then try again!

about 4 years ago · Juan Pablo Isaza Relatório

0

The best way to ensure you get a channel object within the event is to use the guild property off the emitted member.

client.on("guildMemberAdd", (member) => {
      const { guild } = member;
      let chx = db.get(`welchannel_${member.guild.id}`);
      if(chx === null) {return}
        
      const channel = guild.channels.cache.get(chx);
      if (!channel) return;
      
      channel.send(`Welcome to ${message.guild.name}`)
         .catch(console.error);
})

You will need the Guild Member's intent enabled as stated in This Answer for the event to emit.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda