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

292
Views
El bot de Discord no envía mensajes de bienvenida | JS

Así que estoy atascado en la función de bienvenida de mi bot de discordia.

No envía ningún mensaje.

Aquí está el código para el archivo welcome.js:

 module.exports = (client) => { client.on("guildMemberAdd", (member) => { const welcomechannel = '934868156399386676'; const ruleschannel = '934877916041457774'; const embed = new Discord.MessageEmbed() .setTitle(`New member has arrived!`) .setDescription(`Welcome to the server <@${member.id}>! Enjoy your stay and make sure to check our rules ${member.guild.channels.cache.get(ruleschannel).ToString()}! :slight_smile:`) .setColor('#0ed42a') .setTimestamp() client.channels.cache.getwelcomechannel.send(embed) })

aquí está el código para el archivo index.js:

 onst { Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); const config = require("./config.json"); const welcome = require("./welcome.js"); client.once('ready', () => { console.log("Your bot is online!"); welcome(client); }); client.login(config.token);
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

el problema está tanto en index.js como en welcome.js

en primer lugar, no incluye GUILD_MEMBERS como una intención en index.js.

Su segundo problema en welcome.js. getwelcomechannel no es una propiedad válida de ChannelManager , por lo que, como dijo @bedstorm, puede usar la función get() y pasar la identificación del canal. Su código en welcome.js debería verse así

 module.exports = (client) => { client.on("guildMemberAdd", (member) => { const welcomechannel = '934868156399386676'; const ruleschannel = '934877916041457774'; const embed = new Discord.MessageEmbed() .setTitle(`New member has arrived!`) .setDescription(`Welcome to the server <@${member.id}>! Enjoy your stay and make sure to check our rules <#${ruleschannel}>! :slight_smile:`) .setColor('#0ed42a') .setTimestamp() client.channels.cache.get(welcomechannel).send(embed); }) }

Luego solo agregue la intención GUILD_MEMBERS a su cliente

about 4 years ago · Juan Pablo Isaza Report

0

El problema está en esta línea:

client.channels.cache.getwelcomechannel.send(embed)

Hay 2 problemas, getwelcomechannel no es una función, e incluso si fuera una función, no la está llamando.

Para solucionar esto, puede usar el método .get() en la colección de canales.

client.channels.cache.get(welcomechannel).send(embed)

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!