Skip to content

Commit

Permalink
fix json loader
Browse files Browse the repository at this point in the history
  • Loading branch information
z44d committed Sep 20, 2024
1 parent 9144245 commit d892de4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tgram/storage/redis_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def get_chat(
return {}

async def get_chats(self) -> Dict[str, dict]:
return json.loads(await self.client.get("chats") or {})
return json.loads(await self.client.get("chats") or "{}")

async def update_chats(self, chats: Dict[str, dict]) -> bool:
return await self.client.set("chats", json.dumps(chats, ensure_ascii=False))
Expand All @@ -62,7 +62,7 @@ async def get_user(
return {}

async def get_users(self) -> Dict[str, Dict]:
return json.loads(await self.client.get("users") or {})
return json.loads(await self.client.get("users") or "{}")

async def update_users(self, users: Dict[str, dict]) -> bool:
return await self.client.set("users", json.dumps(users, ensure_ascii=False))
Expand All @@ -84,7 +84,7 @@ async def unmute(self, chat_id: int, user_id: int) -> bool:
return await self.update_mute_list(mute_list)

async def get_mute_list(self, _: bool = False) -> List[Tuple[int, int]]:
x = json.loads(await self.get("mute")) or []
x = json.loads(await self.get("mute") or "[]")
return x if _ else [tuple(i) for i in x]

async def update_mute_list(self, mute_list: List[Tuple[int, int]]) -> bool:
Expand Down

0 comments on commit d892de4

Please sign in to comment.