I'm trying to write a loop with awaitMessages loop for a simple game on a Discord bot (discord.js).
Here is my code for this module thus far:
message.channel.awaitMessages(filter2, { max: 1 })
.then(collected2 => {
const response2 = collected2.first();
if (response1.author.id === Fighter1 && response2.author.id === Fighter2)
message.channel.send(`Round #1, FIGHT!!`);
message.channel.send(`${Fighter1.user.username} Punch, Kick, or Block?`);
message.channel.awaitMessages(filter1, { max: 1 })
.then(collected => {
const response = collected.first();
});
if (response.author.id === Fighter1)
const Move1 = response.content
else
message.channel.send(`Not your turn!`)
I want to make it revert to await.Messages if the else condition is met, (and not spam the 'Not your turn!' message in the process.) Can anyone help?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…