if(!message.guild || message.author.bot) return; Schema.findOne({ Guild: message.guild.id}, async(err, data) => { if(!data) return; if(message.channel.id !== data.channel ) fetch(`https://api.monkedev.com/fun/chat?msg=${message.content}&uid=${message.author.id}&key=`) .then(response => response.json()) .then(data => { message.channel.send(data.response) }) .catch(() => { message.channel.send("Couldn't fetch response"); }) });