From 65b5cedb4ec1f55cacaace962b6f10d759c18048 Mon Sep 17 00:00:00 2001 From: Bsian Date: Fri, 17 Apr 2020 03:07:33 +0000 Subject: [PATCH] Remove optional chaining (cherry picked from commit 99ef533121903cd3281535c2bb9457bba2cf3b63) --- src/commands/whois.ts | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/commands/whois.ts b/src/commands/whois.ts index e5be07b..495e64a 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -41,20 +41,22 @@ export default class Whois extends Command { embed.setThumbnail(member.avatarURL); const ackResolve = this.resolveStaffInformation(member.id); let description = ''; - if (ackResolve?.title && ackResolve?.dept) { - description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`; - } - if (ackResolve?.emailAddress) { - description += `${emotes.email} ${ackResolve.emailAddress}\n`; - } - if (ackResolve?.gitlab) { - description += `${emotes.gitlab} ${ackResolve.gitlab}\n`; - } - if (ackResolve?.github) { - description += `${emotes.github} ${ackResolve.github}\n`; - } - if (ackResolve?.bio) { - description += `${emotes.bio} *${ackResolve.bio}*\n`; + if (ackResolve) { + if (ackResolve.title && ackResolve.dept) { + description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`; + } + if (ackResolve.emailAddress) { + description += `${emotes.email} ${ackResolve.emailAddress}\n`; + } + if (ackResolve.gitlab) { + description += `${emotes.gitlab} ${ackResolve.gitlab}\n`; + } + if (ackResolve.github) { + description += `${emotes.github} ${ackResolve.github}\n`; + } + if (ackResolve.bio) { + description += `${emotes.bio} *${ackResolve.bio}*\n`; + } } description += `\n<@${member.id}>`; embed.setDescription(description); @@ -86,7 +88,7 @@ export default class Whois extends Command { if (serverAcknowledgements.length > 0) { embed.addField('Acknowledgements', serverAcknowledgements[0]); } - if (ackResolve?.acknowledgements) { + if (ackResolve && ackResolve.acknowledgements) { embed.addField('Bot Acknowledgements', ackResolve.acknowledgements.join(', ')); } embed.setFooter(this.client.user.username, this.client.user.avatarURL);