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(!getting) getting = 0; if(!getting1) getting1 = 0; 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") { if(getting < getting1){ msg.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){ msg.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') } }) }) }