aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/bank.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-09 19:38:54 -0500
committermat <github@matdoes.dev>2022-04-09 19:38:54 -0500
commit6d08f7f8c91b31e27ff44162b7837751405ec67d (patch)
treedb9c3918819621c22a4a9b83a12f95586e7aff70 /src/cleaners/skyblock/bank.ts
parent58e2fa480e127c30a04dc81256f462b7ad206eb9 (diff)
downloadskyblock-api-6d08f7f8c91b31e27ff44162b7837751405ec67d.tar.gz
skyblock-api-6d08f7f8c91b31e27ff44162b7837751405ec67d.tar.bz2
skyblock-api-6d08f7f8c91b31e27ff44162b7837751405ec67d.zip
oops lol i broke everything
Diffstat (limited to 'src/cleaners/skyblock/bank.ts')
-rw-r--r--src/cleaners/skyblock/bank.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cleaners/skyblock/bank.ts b/src/cleaners/skyblock/bank.ts
index ac46867..50770e7 100644
--- a/src/cleaners/skyblock/bank.ts
+++ b/src/cleaners/skyblock/bank.ts
@@ -15,6 +15,12 @@ export interface BankHistoryItem {
export function cleanBank(data: typedHypixelApi.SkyBlockProfile): Bank {
let history: BankHistoryItem[] = []
+ if (!(data?.banking && 'transactions' in data?.banking)) {
+ return {
+ history: [],
+ balance: undefined
+ }
+ }
if (data?.banking?.transactions) {
let bankBalance = Math.round(data.banking.balance * 10) / 10
@@ -35,7 +41,7 @@ export function cleanBank(data: typedHypixelApi.SkyBlockProfile): Bank {
// history.reverse()
return {
- balance: data?.banking?.balance ? Math.round(data.banking.balance * 10) / 10 : undefined,
+ balance: (data?.banking && 'balance' in data.banking && data.banking.balance) ? Math.round(data.banking.balance * 10) / 10 : undefined,
history
}
} \ No newline at end of file