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

151
Views
El mensaje no se transfiere a otro chat, pero la reacción cuenta en la consola

Me gustaría transferir un mensaje incrustado a otro chat con reacciones, pero tengo algunos problemas porque el BOT no transfiere el mensaje con este código:

 client.on("messageCreate", message => { if (message.channel.id === analiseChannelID) { message.react(aprovada); message.react(nula); message.react(negada); } else if (message.channel.id === aprovadasChannelID) { message.react(arquivada); message.react(negada); } else if (message.channel.id === negadasChannelID) { message.react(arquivada); message.react(negada); } else if (message.channel.id === nulaChannelID) { message.react(arquivada); message.react(negada); } }); client.on("messageReactionAdd", ({ message }) => { const analiseChannel = message.client.channels.cache.get(analiseChannelID); const aprovadasChannel = message.client.channels.cache.get(aprovadasChannelID); console.log("Reaction"); if (message.author.bot) return; if (message.guild.channels.id = analiseChannelID) { const { embeds } = message aprovadasChannel.send({ embeds }) } });

Cuando agregué esto para no dejarlo tomar su propia reacción y enviar spam al chat:

 if (message.author.bot) return;

simplemente ignora para transferir el mensaje.

Lo que tengo que hacer es que si hay una nueva inserción en analiseChannelID , debería reaccionar con 3 emojis y, dependiendo de esas reacciones, transferiría el mensaje a aprovadasChannelID y lo eliminaría de analiseChannelID

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

0

Como se dijo en los comentarios , enviaste el mensaje como un webhook de Discord. Los webhooks se clasifican como mensajes de bot. Si estaba tratando de obtener al usuario que reaccionó, puede usar el segundo argumento del evento messageReactionAdd . Es un objeto User que representa al usuario que reaccionó.

 client.on("messageReactionAdd", ({ message }, user) => { //get the User who reacted const analiseChannel = message.client.channels.cache.get(analiseChannelID); const aprovadasChannel = message.client.channels.cache.get(aprovadasChannelID); console.log("Reaction"); if (user.bot) return; if (message.guild.channels.id = analiseChannelID) { const { embeds } = message aprovadasChannel.send({ embeds }) } });

Tenga en cuenta que hay más errores en el código.

  • la condición de la sentencia if no se ha puesto correctamente. Debe ser == o ===
  • message.guild.channels.id no está definido. Si desea verificar si existe un canal, que es lo que creo que está haciendo, use message.guild.channels.cache.has("ID")
about 4 years ago · Juan Pablo Isaza Report

0

Supongo que el problema está aquí:

 if (message.guild.channels.id = analiseChannelID)

Lo que está haciendo al usar el operador único '=' es asignar el valor analiseChannelID a message.guild.channels.id (que ni siquiera existe ya que guild.channels es un administrador de canales) y luego verificar si el valor asignado es no es un valor falso para javascript. Desafortunadamente, su pregunta no es muy clara sobre lo que está tratando de lograr, pero supongo que lo que quiere hacer es algo como:

 client.on("messageReactionAdd", ({ message }) => { if (message.author.bot) return; const analiseChannel = message.client.channels.resolve(analiseChannelID); const aprovadasChannel = message.client.channels.resolve(aprovadasChannelID); // you can use the has method since the cache is a Collection instance // this if you want to check if the guild has a channel with that id if (message.guild.channels.cache.has(analiseChannelID)) { const { embeds } = message; aprovadasChannel.send({ embeds }); } // this if you want to ckeck if the channel in which the message has been sent is that channel id if(message.channel.id === analiseChannelID) { /* do stuff */ } });
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!