I have a script where if there is a second argument the script will run else it will run an else statement but even if there is no second argument it will always run the script
if(member && args.slice(1) !== undefined)
{
member.kick(args.slice(1).join(' ')).then(() =>{
message.channel.send("Successfully kicked " + "`" + user.tag + "`" +" for " + "**" +args.slice(1).join(' ') + "**" + " 🙂")
}).catch(err =>{
channel.message.send("An unexpected error occured. Logs were sent to the devs")
console.log(err);
return;
});
}else{
if(member){
member.kick().then(() =>{
message.channel.send("Successfullys kicked " + "`" + user.tag + "`")
console.log (args[2], args)
}).catch(err =>{
channel.message.send("An unexpected error occured. Logs were sent to the devs")
console.log(err);
return;
});