diff options
author | mat <github@matdoes.dev> | 2022-04-09 19:38:54 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-09 19:38:54 -0500 |
commit | 6d08f7f8c91b31e27ff44162b7837751405ec67d (patch) | |
tree | db9c3918819621c22a4a9b83a12f95586e7aff70 /src/cleaners/skyblock/bank.ts | |
parent | 58e2fa480e127c30a04dc81256f462b7ad206eb9 (diff) | |
download | skyblock-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.ts | 8 |
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 |