fix(backend): userbot follows kurigram 2.2.26, user and chat parsing is awaited, missing chat is handled
This commit is contained in:
1 parent
d213dfdf64
commit
945adcf879
11 files changed
+13
-11
No files matched your search
@@ -36,6 +36,8 @@ async def _save_user(ctx: CaptureContext, user: User) -> None:
|
||||
|
||||
async def _enrich_chat_meta(client: Client, ctx: CaptureContext, chat_id: int) -> None:
|
||||
chat = await client.get_chat(chat_id)
|
||||
if chat is None:
|
||||
return
|
||||
photo = chat.photo
|
||||
photo_unique_id = photo.big_photo_unique_id if photo else None
|
||||
photo_file_id = photo.big_file_id if photo else None
|
||||
|
||||
@@ -12,7 +12,7 @@ STALE_FILE_ID = (FileIdInvalid, FileReferenceExpired, FileReferenceInvalid)
|
||||
|
||||
async def _fresh_file_id(client: Client, owner_id: int, unique_id: str) -> str | None:
|
||||
chat = await client.get_chat(owner_id)
|
||||
photo = chat.photo
|
||||
photo = chat.photo if chat else None
|
||||
if photo and photo.big_photo_unique_id == unique_id:
|
||||
return photo.big_file_id
|
||||
photos = client.get_chat_photos(owner_id)
|
||||
|
||||
@@ -46,7 +46,7 @@ async def _save_found(
|
||||
source = _source(peer, users, chats)
|
||||
if source is None:
|
||||
return None
|
||||
chat = Chat._parse_chat(client, source) # noqa: SLF001
|
||||
chat = await Chat._parse_chat(client, source) # noqa: SLF001
|
||||
if chat is None or chat.id is None:
|
||||
return None
|
||||
await save_chat(ctx, chat)
|
||||
|
||||
Reference in new issue
Block a user