From be6c2ff43796452bdb0a963c44a0cce29bf3e19f Mon Sep 17 00:00:00 2001 From: wulan17 Date: Mon, 9 Jun 2025 19:30:04 +0700 Subject: [PATCH] pyrofork: types: Wallpaper: Make document optional Signed-off-by: wulan17 --- pyrogram/types/messages_and_media/wallpaper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyrogram/types/messages_and_media/wallpaper.py b/pyrogram/types/messages_and_media/wallpaper.py index e5ea024b..44a7a33e 100644 --- a/pyrogram/types/messages_and_media/wallpaper.py +++ b/pyrogram/types/messages_and_media/wallpaper.py @@ -54,7 +54,7 @@ class Wallpaper(Object): self, id: int, slug: str, - document: "types.Document", + document: "types.Document" = None, is_creator: bool = None, is_default: bool = None, is_pattern: bool = None, @@ -73,7 +73,9 @@ class Wallpaper(Object): @staticmethod def _parse(client: "pyrogram.Client", wallpaper: "raw.base.WallPaper") -> "Wallpaper": - doc = wallpaper.document + doc = None + if not isinstance(wallpaper, raw.types.WallPaperNoFile): + doc = wallpaper.document attributes = {type(i): i for i in doc.attributes} file_name = getattr( @@ -84,7 +86,7 @@ class Wallpaper(Object): return Wallpaper( id=wallpaper.id, slug=wallpaper.slug, - document=types.Document._parse(client, doc, file_name), + document=types.Document._parse(client, doc, file_name) if doc is not None else None, is_creator=getattr(wallpaper, "creator", None), is_default=getattr(wallpaper, "default", None), is_pattern=getattr(wallpaper, "pattern", None),