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

209
Visualizações
Intentando configurar un nuevo welcome.js
const Discord = require('discord.js') const bot = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS"]}) const config = require('./botconfig.json') const prefix = '...'; const welcome = require("./welcome"); const Welcome = require("discord-welcome"); const client = new Discord.Client({ intents: [ Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MEMBERS, ], }); bot.on('ready', async () => { console.log(`${bot.user.username} is online and in ${bot.guilds.cache.size} server!`) }) // START OF WELCOME BOT bot.on('guildMemberAdd', async member => { client.channels.cache.get('ChannelHere') let embed = new Discord.MessageEmbed() .setTitle('TESTING EMBED') .setDescription('TITLE LAUNCHED...') .setColor("#ffd8e3") channel.send(`please welcome ${member} to the server!`, embed) //client.channels.get("775086826154229840").send(`please welcome ${member} to the server!`, embed) //msg.channel.send(`please welcome ${member} to the server!`, embed) }); // END OF WELCOME BOT bot.login(config.token)

Cada vez que un usuario se une, falla. ¿Funcionó en el último servidor pero no ahora? Cualquier ayuda o indicación de que algo anda mal sería muy apreciada. soy nuevo en esto lo siento si es malo

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

0

Así que hay un par de cosas mal aquí. Primero tienes 2 “clientes” definidos

 // first client const bot = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS"]}) // second client const client = new Discord.Client({ intents: [ Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MEMBERS, ], });

Entonces tu código dice lo siguiente

 bot.on('guildMemberAdd', async member => { // above line states that the first client will do something when a member joins client.channels.cache.get('ChannelHere') //above line states that the second client will retrieve the channel … channel.send(`please welcome ${member} to the server!`, embed) //above line has the first client doing something (sending a message) however the first client didn't retrieve the channel so channel.anything won't work. client.channels.cache.get("775086826154229840").send(`please welcome ${member} to the server!`, embed) //this line would technically work except client isn't logged in, bot is and you needed the .cache part msg.channel.send(`please welcome ${member} to the server!`, embed) // msg is not defined probably just need to delete msg }); }

Prueba esto y debería funcionar

 const Discord = require('discord.js') // if using discord v12 pick only one bot const bot = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS"]}) // if using discord v13 pick only one bot const bot = new Discord.Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES] }) const config = require('./botconfig.json') const prefix = '...'; const welcome = require("./welcome"); const Welcome = require("discord-welcome"); bot.on('ready', async () => { console.log(`${bot.user.username} is online and in ${bot.guilds.cache.size} server!`) }) // START OF WELCOME BOT bot.on('guildMemberAdd', async member => { const channel = bot.channels.cache.get('ChannelHere') let embed = new Discord.MessageEmbed() .setTitle('TESTING EMBED') .setDescription('TITLE LAUNCHED...') .setColor("#ffd8e3") // if using discord v12 channel.send(`please welcome ${member} to the server!`, embed) // if using discord v13 channel.send({ content: `please welcome ${member} to the server!`, embeds: [embed] }) }); // END OF WELCOME BOT bot.login(config.token)
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