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?