Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda