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

117
Views
Estoy tratando de agregar un usuario a un rol cuando reacciono a una inserción y no lo agregaré

Hice un comando al usar una inserción, el bot reacciona y cuando alguien más reacciona, los agregará a una regla. Pero no está agregando al usuario al rol y no estoy seguro de por qué.

 const {MessageEmbed} = require("discord.js"); module.exports = { name: "reactionrole", async execute(message, args, client) { const channel = '914676864004554803'; const memberRole = message.guild.roles.cache.find(role => role.name === "Members"); const emojireact = '👍'; let embed = new MessageEmbed() .setColor("#e42643") .setTitle("MineCraft Server Rules") .setDescription( "To keep our server safe we need a few basic rules for everyone to follow!" ) .setFooter("Please press 👍 to verify and unlock the rest of the server!") let messageEmbed = await message.channel.send({ embeds: [embed] }); messageEmbed.react(emojireact); client.on('messageReactionAdd', async(reaction, user, GUILD_MESSAGES_REACTIONS) => { 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 === emojireact) { await reaction.message.guild.members.cache.get(user.id).roles.add(memberRole); } }else { return; } }); } }

El comando muestra la inserción y el bot reacciona, pero el usuario no se agrega.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No estoy seguro de cómo no obtiene un ReferenceError pero está pasando una variable desconocida al parámetro.
En .add(Members) , no veo Members definidos en ninguna parte del código que envió.

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!