const Discord = require('discord.js'); let blist = []; let levela = []; function arrayRemove(arr, value) { return arr.filter(function(yeet){ return yeet != value; }); }; module.exports = { name: 'miniboss', description: 'Miniboss list', aliases: ['mb'], usage: 'e!miniboss [join, leave, list]', run: async(client, message, args) => { let type = args[0]; let level = args[1]; if(!type) return message.reply({ embeds: [new Discord.MessageEmbed().setColor('RED').setDescription(`Hey there ${message.author.tag}\nPlease you any of the following \`join\`, \`leave\` or \`list\``)]}) if(message.channel.id !== '894577170616295504') return; switch (type) { case 'join': { if(!level) return message.reply(`Couldn't add <@${message.author.id}> to the list.\nReason: Missing level`) if(isNaN(level)) return message.reply('Enter a number for the level not alphabet') if(level > 49999) return message.reply(`You cannot use a level more then 50K!!`) if(!blist.includes(message.author.id)) { blist.push(message.author.id) levela.push(level) message.channel.send(`<@${message.author.id}> you are the ${blist.length} player of the list\nRemaining ${parseInt(10 - blist.length)}`) } else { message.channel.send(`<@${message.author.id}> you already in the list!!`) } } break; case 'leave': { if(blist.includes(message.author.id)) { for (let i = 0; i < blist.length; i++) { if(blist[i] == message.author.id) { blist.splice(i, 1) } } message.channel.send(`<@${message.author.id}> you left the list!\nRemaining: ${parseInt(10 - blist.length)}`) } else { message.channel.send(`You ain\'t in the list to leave!`) } } break; } } }