decode-fix
This commit is contained in:
@@ -20,7 +20,7 @@ async def load_messages(chat_id: str, limit: int = 5, offset: int = 0, ids=None)
|
||||
mids = await redis.lrange(
|
||||
f"chats/{chat_id}/message_ids", offset, offset + limit
|
||||
)
|
||||
mids = [mid.decode("utf-8") for mid in mids]
|
||||
mids = [mid for mid in mids]
|
||||
message_ids += mids
|
||||
if message_ids:
|
||||
message_keys = [f"chats/{chat_id}/messages/{mid}" for mid in message_ids]
|
||||
@@ -80,7 +80,7 @@ async def load_messages_by(_, info, by, limit: int = 10, offset: int = 0):
|
||||
"""load :limit messages of :chat_id with :offset"""
|
||||
author_id = info.context["author_id"]
|
||||
user_chats = await redis.execute("SMEMBERS", "chats_by_author/" + str(author_id))
|
||||
user_chats = [c.decode("utf-8") for c in user_chats]
|
||||
user_chats = [c for c in user_chats]
|
||||
if user_chats:
|
||||
messages = []
|
||||
by_chat = by.get("chat")
|
||||
|
Reference in New Issue
Block a user