text: const Discord = require('discord.js'),
      client = new Discord.Client({
          fetchAllMembers: true
      }),
      config = require('./config.json'),
      fs = require('fs')
   
  client.login(config.token)
  client.commands = new Discord.Collection()
  client.db = new Set()
   
  fs.readdir('./commands', (err, files) => {
      if (err) throw err
      files.forEach(file => {
          if (!file.endsWith('.js')) return
          const command = require(`./commands/${file}`)
          client.commands.set(command.name, command)
      })
  })
   
  client.on('message', message => {
      if (message.type !== 'DEFAULT' || message.author.bot) return
   
      const args = message.content.trim().split(/ +/g)
      const commandName = args.shift().toLowerCase()
      if (!commandName.startsWith(config.prefix)) return
      const command = client.commands.get(commandName.slice(config.prefix.length))
      if (!command) return
      if(command.guildOnly && !message.guild)  return message.channel.send('Cette commande ne peut être utilisée que dans un serveur.')
      command.run(message, args, client)
  })
   
  client.on('ready', () => {
      const statuses = [
          () => `r!help | Serveurs: ${client.guilds.cache.size}`,
          () => `r!help | Users: ${client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)}`
      ]
      let i = 0
      setInterval(() => {
          client.user.setActivity(statuses[i](), {type: 'PLAYING'})
          i = ++i % statuses.length
      }, 1e4)
  })
   
  client.on('channelCreate', channel => {
      if (!channel.guild) return
      const muteRole = channel.guild.roles.cache.find(role => role.name === 'Muted')
      if (!muteRole) return
      channel.createOverwrite(muteRole, {
          SEND_MESSAGES: false,
          CONNECT: false,
          ADD_REACTIONS: false
      })
      
      client.on('guildMemberAdd', member => {
          member.guild.channels.cache.get(config.greeting.channel).send(`${member} a rejoint le serveur. Nous sommes désormais ${member.guild.memberCount} ! 🎉`)
          member.roles.add(config.greeting.role)
      })
       
      client.on('guildMemberRemove', member => {
          member.guild.channels.cache.get(config.greeting.channel).send(`${member.user.tag} a quitté le serveur... 😢`)
      })
  })