diff options
author | Luca Matei Pintilie <lucafulger@gmail.com> | 2022-08-31 18:14:23 +0000 |
---|---|---|
committer | Luca Matei Pintilie <lucafulger@gmail.com> | 2022-08-31 18:14:23 +0000 |
commit | 51962c7582109d269045b1cfe8e0f4e230d53a92 (patch) | |
tree | cfdbb85850d89a3e6fce58e5ba5766b8e2f00563 /src/srcom | |
parent | 59456f6fa2303972c0ac7de1d1a33f16df89f544 (diff) | |
download | speedrunbot-slash-51962c7582109d269045b1cfe8e0f4e230d53a92.tar speedrunbot-slash-51962c7582109d269045b1cfe8e0f4e230d53a92.tar.gz speedrunbot-slash-51962c7582109d269045b1cfe8e0f4e230d53a92.tar.bz2 speedrunbot-slash-51962c7582109d269045b1cfe8e0f4e230d53a92.tar.lz speedrunbot-slash-51962c7582109d269045b1cfe8e0f4e230d53a92.tar.xz speedrunbot-slash-51962c7582109d269045b1cfe8e0f4e230d53a92.tar.zst speedrunbot-slash-51962c7582109d269045b1cfe8e0f4e230d53a92.zip |
user.location can be null
Diffstat (limited to '')
-rw-r--r-- | src/srcom/types.d.ts | 2 | ||||
-rwxr-xr-x | src/srcom/whois.ts | 34 |
2 files changed, 19 insertions, 17 deletions
diff --git a/src/srcom/types.d.ts b/src/srcom/types.d.ts index 010bb88..46f6204 100644 --- a/src/srcom/types.d.ts +++ b/src/srcom/types.d.ts @@ -67,7 +67,7 @@ export namespace SpeedrunCom { "name-style": NameStyle; role: string; signup: Date; - location: Location; + location?: Location; twitch: ExternalAccount; hitbox?: ExternalAccount; youtube: ExternalAccount; diff --git a/src/srcom/whois.ts b/src/srcom/whois.ts index 7f00855..b281e96 100755 --- a/src/srcom/whois.ts +++ b/src/srcom/whois.ts @@ -46,22 +46,24 @@ export async function whois( } output.push(`${fmt.bold("Socials")}: ${socials.join(", ")}`); } - if (user.location.region) { - output.push( - `${fmt.bold("Region")}: ${user.location.region.names.international} ${ - user.location.region.names.japanese - ? `(${user.location.region.names.japanese})` - : "" - }/${user.location.region.code}`, - ); - } else if (user.location.country) { - output.push( - `${fmt.bold("Country")}: ${user.location.country.names.international} ${ - user.location.country.names.japanese - ? `(${user.location.country.names.japanese})` - : "" - }(${user.location.country.code})`, - ); + if (user.location) { + if (user.location.region) { + output.push( + `${fmt.bold("Region")}: ${user.location.region.names.international} ${ + user.location.region.names.japanese + ? `(${user.location.region.names.japanese})` + : "" + }/${user.location.region.code}`, + ); + } else if (user.location.country) { + output.push( + `${fmt.bold("Country")}: ${user.location.country.names.international} ${ + user.location.country.names.japanese + ? `(${user.location.country.names.japanese})` + : "" + }(${user.location.country.code})`, + ); + } } return output.join("\n"); } |