Estoy tratando de crear un comando de juego en el que los jugadores deben adivinar dónde está el gato entre varias cajas. Se hizo el concepto básico, pero de alguna manera no puedo recopilar más de 1 mensaje, detendría el proceso después de recopilar el primero.
El código:
const Command = require("../structures/Command.js"); module.exports = new Command({ name: "cat", async run(message, args, client) { //Preparing stuff var i = 0; var cat = Math.floor(Math.random()*5)+1; message.channel.send("A wild cat have appeared and hiden in 5 random boxes, can you find it?") const filter = (user) => { return user.author.id === message.author.id }; //Loop while (i<10) { console.log(cat); let collected = await message.channel.awaitMessages(filter, { max: 1, time: 15000, errors: ['time'] }); answer = collected.first().content; console.log(answer) //checking if (answer === cat){ message.reply("You opened the correct box!"); var i = 727; console.log("Yes") } else { var move = Math.floor(Math.random()*10)+1; if (cat===1){var move = 1} else if (cat===5){var move = 10} if (move<5){var cat = cat+1} else {var cat = cat-1} var i = i + 1; var days = 10 - cat; console.log(cat) message.channel.send(`You didn't guessed the correct box, the cat has now moved to another box. You got ${days} tries left`) } } } });