text: const {Collection, Client, Discord} = require('discord.js')
  const fs = require('fs')
  const client = new Client({
      disableEveryone: true
  })
  const config = require('./config.json')
  const prefix = config.prefix
  const db = require('quick.db')
  const token = config.token
  client.commands = new Collection();
  client.aliases = new Collection();
  client.categories = fs.readdirSync("./commands/");
  ["command"].forEach(handler => {
      require(`./handlers/${handler}`)(client);
  }); 
  client.on('ready', () => {
      client.user.setActivity(`${prefix}help`)
      console.log(`${client.user.username} ✅`)
  })
  client.on('message', async message =>{
      if(message.author.bot) return;
      if(!message.content.startsWith(prefix)) return;
      if(!message.guild) return;
      if(!message.member) message.member = await message.guild.fetchMember(message);
      const args = message.content.slice(prefix.length).trim().split(/ +/g);
      const cmd = args.shift().toLowerCase();
      if(cmd.length == 0 ) return;
      let command = client.commands.get(cmd)
      if(!command) command = client.commands.get(client.aliases.get(cmd));
      if(command) command.run(client, message, args) 
      if(db.has(`afk.${message.author.id}+${message.guild.id}`)) {
          const info = db.get(`afk.${message.author.id}+${message.guild.id}`)
          db.delete(`afk.${message.author.id}+${message.guild.id}`)
          message.reply(`Your afk status have been removed (${info})`)
      }
      if(message.mentions.members.first()) {
          if(db.has(`afk.${message.mentions.members.first().id}+${message.guild.id}`)){
              message.channel.send(message.mentions.members.first().user.tag);
          }
      }
  })
  //testing
  
  
  client.login(token)
  