aboutsummaryrefslogtreecommitdiff
path: root/src/srcom
diff options
context:
space:
mode:
authorLuca Matei Pintilie <lucafulger@gmail.com>2022-08-31 18:14:23 +0000
committerLuca Matei Pintilie <lucafulger@gmail.com>2022-08-31 18:14:23 +0000
commit51962c7582109d269045b1cfe8e0f4e230d53a92 (patch)
treecfdbb85850d89a3e6fce58e5ba5766b8e2f00563 /src/srcom
parent59456f6fa2303972c0ac7de1d1a33f16df89f544 (diff)
downloadspeedrunbot-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.ts2
-rwxr-xr-xsrc/srcom/whois.ts34
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");
}