const {Command} = require('../../lib.js')


    class ban extends Command{
        constructor(client){
            super(client, {
                name: 'ban',
                group:'admin',
                needsAdmin: true,
                description: 'Bans a user from the server.'

            })
        }
        async run(message, args) {
            // Get the user mentioned in the message
            const user = message.mentions.users.first();
            // Check if the user mentioned exists and is not a bot
            if (!user || user.bot) {
              return new ErrorMessage(this.client).send(ErrorType.Arguments, message, ['User is a bot, or you sent something wrong.'])
            }
          
            // Ban the user
            try {
              await user.ban();
              return message.channel.send(`${user.tag} was banned from the server.`);
            } catch (error) {
              return console.log(`Ban: An error occurred: ${error.message}`);
            }
          } 
    
}module.exports = ban;