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

198
Visualizações
Script of welcome / goodbye to discord js bot Error

He is giving me this script of welcome/goodbye to Discord error and he has already tried many things if someone helps me I would appreciate it very much, Thanks

module.exports = (client) => {
    const channelIdA = '718596514305277972'
    
    client.on('guildMemberAdd', (member) => {
       console.log("Se ha unido una nueva persona al servidor TPA")
       
         const messageA = `message`

          const channel = (channelIdA)
          channel.send(messageA)
       })
   }
   
   module.exports = (client) => {
    const channelIdB = '890891192995303424'
    
    client.on('guildMemberRemove', (member) => {
       console.log("Se ha salido una persona del servidor TPA")
       
         const messageB = `message`
          
          const channel = (channelIdB)
          channel.send(messageB)
    })
}
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You are attempting to send a message to a channel by calling the .send() method. However, you are calling the method on a string. The send() method only exists on text based channels. To send a message to a specific channel, replace your message sending code with this

client.on("guildMemberAdd", members => {
 client.channels.cache.get("REPLACE WITH CHANNEL ID").send("message")
});

client.on("guildMemberRemove", members => {
 client.channels.cache.get("REPLACE WITH OTHER CHANNEL ID").send(" other message")
});

If the above does not work, try this: (works without cache)

client.on("guildMemberAdd", async (member) => {
 const channel = await client.channels.fetch("REPLACE WITH CHANNEL ID")
 channel.send(`${member.user.username}, welcome`)
});

client.on("guildMemberRemove", async (member) => {
 const channel = await client.channels.fetch("REPLACE WITH OTHER CHANNEL ID")
 channel.send(`${member.user.username} has left`)
});
about 4 years ago · Juan Pablo Isaza Relatório

0

You should be getting the channel using this. If you already have the channel in cache (something happened in the channel after the bot started), you can use the channels cache as well.

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