Bio will not output if there is an empty array in Bio
if (roles) {
const numberOfRoles = roles.length;
embed.addField(`Roles (${numberOfRoles})`, roles.join(', ').toUpperCase());
}
We should check if the array is empty
if (roles) {
const numberOfRoles = roles.length;
if(numberOfRoles > 0) {
embed.addField(`Roles (${numberOfRoles})`, roles.join(', ').toUpperCase());
}
}
We should check if the array is empty
if (roles) { const numberOfRoles = roles.length; if(numberOfRoles > 0) { embed.addField(`Roles (${numberOfRoles})`, roles.join(', ').toUpperCase()); } }
if (roles && !!roles.length) {
embed.addField(`Roles (${numberOfRoles})`, roles.join(', ').toUpperCase());
}
Thanks @AllanRegush for fixing 👍 . Nice simplification @stemount .
I can't remember why the roles shout 🤷♂️ - but I agree, maybe leave that for now
Most helpful comment