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

135
Views
Comando RPS con reacciones que no funcionan - discord.js

Estoy haciendo un bot de discord en discord.js v13 y necesito hacer un comando de piedra, papel o tijera e hice el siguiente código: (Omití algunas partes porque no pude publicarlo, principalmente incrustaciones como mensajes NoResponse, así que si algo no tiene un valor, ¡el nombre probablemente sugiere lo que se supone que debe ser!

Código:

 const discord = require('discord.js'); You lost! :confused:") .setColor(colors.COLOR); const cancelled = new discord.MessageEmbed() .setDescription(":x: Cancelled! You failed to respond in time!") .setColor(colors.COLOR); module.exports = { name: "rps", aliases: [], async execute(client, message, args) { message.channel.send({ embeds: [noResponse] }).then(msg => { msg.react("🪨"); msg.react("✂️"); msg.react("📰"); const filter = (reaction, user) => { return ['🪨', '✂️', '📰'].includes(reaction.emoji.name) && user.id === message.author.id; } const choices = ['🪨', '✂️', '📰']; const me = choices[Math.floor(Math.random() * choices.length)]; msg.awaitReactions({ filter, max: 1, time: 20000, error: ['time'] }).then( async (collected) => { const reaction = collected.first(); const result = new Discord.MessageEmbed() .setTitle("Results", `${reaction.emoji.name}`) .addField("Your choice:", `${me}`) .setColor(colors.COLOR) msg.edit(result); if ((me === "🪨" && reaction.emoji.name === "✂️") || (me === "✂️" && reaction.emoji.name === "📰") || (me === "📰" && reaction.emoji.name === "🪨")) { message.channel.send({ embeds: [youLost] }); } else if (me === reaction.emoji.name) { return message.channel.send({ embeds: [resultTie] }); } else { return message.channel.send({ embeds: [youWin] }); } }) .catch(collected => { message.channel.send({ embeds: [cancelled] }); }); }); } }

Sin embargo, cuando ejecuto el bot, envía el mensaje y agrega las reacciones, pero luego, cuando se acaba el tiempo, da la inserción cancelada (se agotó el tiempo) a pesar de que reaccioné al mensaje.

Intenté arreglarlo de varias maneras, pero no sé qué es. ¿Es algo que cambió en discord.js v13?

No sé cómo arreglar esto. ¿Alguien sabe?

about 4 years ago · Juan Pablo Isaza
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!