Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alec-jensen committed Aug 19, 2024
1 parent ecadde1 commit 80e20eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kidney-bot/cogs/economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80e20eb

Please sign in to comment.