From 80e20eb477a37a9f43770efa57b687b3c2078a78 Mon Sep 17 00:00:00 2001 From: Alec Jensen Date: Mon, 19 Aug 2024 18:45:59 -0500 Subject: [PATCH] fix bug --- kidney-bot/cogs/economy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kidney-bot/cogs/economy.py b/kidney-bot/cogs/economy.py index 6486381..62a591f 100644 --- a/kidney-bot/cogs/economy.py +++ b/kidney-bot/cogs/economy.py @@ -205,11 +205,13 @@ async def bank(self) -> int: async def inventory(self) -> dict: doc = await self.database.currency.find_one({'userID': str(self.user.id)}) + if type(doc.get('inventory')) is not dict: + doc['inventory'] = {} return doc['inventory'] async def add_item(self, item: Item): doc = await self.database.currency.find_one({'userID': str(self.user.id)}) - if type(doc['inventory']) is not dict: + if type(doc.get('inventory')) is not dict: doc['inventory'] = {} count = doc['inventory'].get(item.id, 0) count += 1