client.on("message", async message => { // <- This is "line 1" in the simplified version of my code if(message.author.bot || !message.guild || !message.content.toLowerCase().startsWith(prefix)) return const args = message.content.slice(prefix.length).trim().split(/ /g) const command = args.shift().toLowerCase() if(command === 'warnings'){ // <- This is "line 2" in the simplified version of my code let user = message.mentions.users.first() // <- This is "line 3" in the simplified version of my code, its value is undefined if(!user) user = await getUser("checking warns") // <- This is "line 4" in the simplified version of my code if(user === null) return let reason = null let isForceReason = await getSetting("isForceReason") if(isForceReason === true){ reason = await getReply(m => m.id === message.author.id && m.content,`**Forced Reason** - Please type the **reason** for checking __${user.tag}__'s warns`) if(reason === null) return if(reason.content) reason = reason.content } if(isForceReason === true && reason === null) return let getWarns = await warns.findOne({id: user.id,guild: message.guild.id}) // <- This is "line 6" in the simplified version of my code // This is the "getObj" function async function getUser(command){ message.channel.send(`${message.author} who are we **${command}**? Reply within 5 minutes`).then(function(){ let clt = message.channel.createMessageCollector(m => m.author.id === message.author.id && m.mentions.users.first(),{time: ms("5 minutes")}) clt.on("collect", msg => { clt.stop() return msg.mentions.users.first() }) clt.on("end", clted => { if(clted.size === 0){ message.channel.send(`No reply, command cancled`) return null } }) }) }