client.on("message", async message => { const fetchprefix = await mongopref.fetch(client, message.guild.id); if (message.mentions.users.has(client.user.id) && !message.author.bot) { let args = message.content.split(" ") if(args.length > 1) { fetch("https://api.udit.gq/api/chatbot?message=" + message.content) .then(res => res.json()) .then(json => { if(!json.message) return; message.channel.startTyping() setTimeout(function(){ message.reply(json.message) }, 2000) .then(message.channel.stopTyping(true)) }).catch(err => {}); } else { message.reply(`\nMy prefix is \`>\`\nFor help say \`>help\``) } }; if(blacklist.users.some(uID => uID == message.author.id)) return; if(blacklist.servers.some(uID => uID == message.guild.id)) return; if(message.author.bot) return; if(message.channel.type === 'dm') return; if(message.content.startsWith(fetchprefix.prefix)) { const args = message.content.slice(fetchprefix.prefix.length).trim().split(/ +/); const command = args.shift().toLowerCase(); if(!client.commands.has(command)) return; try { client.commands.get(command).run(client, message, args); } catch (error){ console.error(error); } } })