From 877d0426a3f50db42c152b1e631bb32e3a7be48f Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 14 Mar 2022 03:00:34 -0400 Subject: [PATCH] Handle null XP values --- ahtcg_bot.py | 7 ++++--- arkhamdb.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ahtcg_bot.py b/ahtcg_bot.py index 8a09755..8167405 100755 --- a/ahtcg_bot.py +++ b/ahtcg_bot.py @@ -92,9 +92,10 @@ class ArkhamDBUpdater(commands.Bot): status = f"{prefix}[{deck['name']}]({url}) [{deck['id']}]" issues = [] - unspent_xp = deck["xp"] - deck["xp_spent"] - if unspent_xp > 0: - issues.append(f"{unspent_xp} unspent XP") + if deck["xp"] is not None: + unspent_xp = deck["xp"] - deck["xp_spent"] + if unspent_xp > 0: + issues.append(f"{unspent_xp} unspent XP") if deck["problem"] is not None: issues.append(deck["problem"]) diff --git a/arkhamdb.py b/arkhamdb.py index 1f4ead2..b18c2ab 100644 --- a/arkhamdb.py +++ b/arkhamdb.py @@ -21,8 +21,8 @@ class ArkhamDBDeck(TypedDict): sideSlots: Union[list[str], dict[str, int]] ignoreDeckLimitSlots: Optional[str] version: str - xp: int - xp_spent: int + xp: Optional[int] + xp_spent: Optional[int] xp_adjustment: int exile_string: Optional[str] taboo_id: int