Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!