Remove optional chaining

merge-requests/9/merge
Bsian 2020-04-17 04:07:33 +01:00
parent cfe5e65ed8
commit 99ef533121
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 17 additions and 15 deletions

View File

@ -41,21 +41,23 @@ export default class Whois extends Command {
embed.setThumbnail(member.avatarURL); embed.setThumbnail(member.avatarURL);
const ackResolve = this.resolveStaffInformation(member.id); const ackResolve = this.resolveStaffInformation(member.id);
let description = ''; let description = '';
if (ackResolve?.title && ackResolve?.dept) { if (ackResolve) {
if (ackResolve.title && ackResolve.dept) {
description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`; description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`;
} }
if (ackResolve?.emailAddress) { if (ackResolve.emailAddress) {
description += `${emotes.email} ${ackResolve.emailAddress}\n`; description += `${emotes.email} ${ackResolve.emailAddress}\n`;
} }
if (ackResolve?.gitlab) { if (ackResolve.gitlab) {
description += `${emotes.gitlab} ${ackResolve.gitlab}\n`; description += `${emotes.gitlab} ${ackResolve.gitlab}\n`;
} }
if (ackResolve?.github) { if (ackResolve.github) {
description += `${emotes.github} ${ackResolve.github}\n`; description += `${emotes.github} ${ackResolve.github}\n`;
} }
if (ackResolve?.bio) { if (ackResolve.bio) {
description += `${emotes.bio} *${ackResolve.bio}*\n`; description += `${emotes.bio} *${ackResolve.bio}*\n`;
} }
}
description += `\n<@${member.id}>`; description += `\n<@${member.id}>`;
embed.setDescription(description); embed.setDescription(description);
@ -86,7 +88,7 @@ export default class Whois extends Command {
if (serverAcknowledgements.length > 0) { if (serverAcknowledgements.length > 0) {
embed.addField('Acknowledgements', serverAcknowledgements[0]); embed.addField('Acknowledgements', serverAcknowledgements[0]);
} }
if (ackResolve?.acknowledgements) { if (ackResolve && ackResolve.acknowledgements) {
embed.addField('Bot Acknowledgements', ackResolve.acknowledgements.join(', ')); embed.addField('Bot Acknowledgements', ackResolve.acknowledgements.join(', '));
} }
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);