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

145
Vistas
¿Cómo llamo a un evento dentro de module.exports?

Estoy tratando de tener un tipo de comando de rol de reacción, pero sigo recibiendo este error. Estoy tratando de agregar una reacción a mi comando de inserción. Traté de tener el evento en index.js pero ofc no funcionó. Cualquier ayuda sería apreciada.

 C:\Users\moham\OneDrive\Desktop\discord_bot\commands\reaction.js:25 client.on('messageReactionAdd', async(reaction, user) => {

Este es mi código:

 module.exports = { name: 'reactionrole', description: "Sets up a reaction role message!", async execute(message, args, Discord, client) { const channel = 'YOUR_CHANNEL'; const yellowTeamRole = message.guild.roles.cache.find(role => role.name === "YOUR_ROLE"); const blueTeamRole = message.guild.roles.cache.find(role => role.name === "YOUR_ROLE"); const yellowTeamEmoji = 'YOUR_EMOJI'; const blueTeamEmoji = 'YOUR_EMOJI'; let embed = new Discord.MessageEmbed() .setColor('#e42643') .setTitle('Choose a team to play on!') .setDescription('Choosing a team will allow you to interact with your teammates!\n\n' + `${yellowTeamEmoji} for yellow team\n` + `${blueTeamEmoji} for blue team`); let messageEmbed = await message.channel.send(embed); messageEmbed.react(yellowTeamEmoji); messageEmbed.react(blueTeamEmoji); client.on('messageReactionAdd', async (reaction, user) => { if (reaction.message.partial) await reaction.message.fetch(); if (reaction.partial) await reaction.fetch(); if (user.bot) return; if (!reaction.message.guild) return; if (reaction.message.channel.id == channel) { if (reaction.emoji.name === yellowTeamEmoji) { await reaction.message.guild.members.cache.get(user.id).roles.add(yellowTeamRole); } if (reaction.emoji.name === blueTeamEmoji) { await reaction.message.guild.members.cache.get(user.id).roles.add(blueTeamRole); } } else { return; } }); client.on('messageReactionRemove', async (reaction, user) => { if (reaction.message.partial) await reaction.message.fetch(); if (reaction.partial) await reaction.fetch(); if (user.bot) return; if (!reaction.message.guild) return; if (reaction.message.channel.id == channel) { if (reaction.emoji.name === yellowTeamEmoji) { await reaction.message.guild.members.cache.get(user.id).roles.remove(yellowTeamRole); } if (reaction.emoji.name === blueTeamEmoji) { await reaction.message.guild.members.cache.get(user.id).roles.remove(blueTeamRole); } } else { return; } }); }

}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No agregue nuevos eventos de clientes dentro de un evento. En su lugar, espere las reacciones de un mensaje.

 const filter = (reaction, user) => user.id === message.author.id; message.awaitReactions({filter, time: 60000}) .then(reactions => reactions.first()) .then(reaction => { console.log(`${message.author.tag} reacted with ${reaction.emoji.name}`) })

Mensaje#awaitReactions

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