if (message.content.startsWith(prefix + "battle")) { let user = message.mentions.users.first(); if (!user) return message.reply("Please include a person to battle"); let getting = db.fetch(`strength_${message.author.id}`); let getting1 = db.fetch(`strength_${user.id}`); let getting2 = db.fetch(`health_${message.author.id}`); let getting3 = db.fetch(`health_${user.id}`); if (!getting1) { return message.channel.send( `${user}` + " please do " + prefix + "rpg to set up a rpg account" ); } message.channel .send( message.author.username + " has challenged " + user.username + " type `accept` to accept the battle type `decline` to decline the battle" ) .then(msg => { const filter = u => (u.id = user.id); msg.channel .awaitMessages(filter, { max: 1, time: 10000 }) .then(collected => { if (collected.first().content == "accept") { console.log("fish"); if (getting < getting1) { message.channel.send( new Discord.MessageEmbed() .setTitle(`${message.author.username} has lost the battle`) .addField( `${message.author.username} health:`, `${getting2}` ) .addField(`${user.username} health:`, `${getting3}`) ); } else if (getting1 < getting) { console.log("dis"); message.channel.send( new Discord.MessageEmbed() .setTitle(`${message.author.username} has won the battle`) .addField( `${message.author.username} health:`, `${getting2}` ) .addField(`${user.username} health:`, `${getting3}`) ); } } else if (collected.first().content == "decline") { msg.channel.send(user.username + " has declined the battle"); } }); }); }