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 = m => m.content.includes('accept') && user.id === user.id const collector = message.channel.createMessageCollector(filter, { time: 15000 }); const filter2 = m => m.content.includes('decline') && user.id === user.id const collector2 = message.channel.createMessageCollector(filter2, { time: 15000 }); collector.on('collect', m => { 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}`) ); } }); collector2.on('collect', m => { message.reply(user.username + ' has declined the battle') }); }); });