From 9aefff9f8db13ea4a962fc13d3ad10d96db1508b Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 12 Aug 2022 18:20:05 +0200 Subject: [PATCH] Fix join applications for public chats --- pyrogram/types/user_and_chats/chat_invite_link.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyrogram/types/user_and_chats/chat_invite_link.py b/pyrogram/types/user_and_chats/chat_invite_link.py index 7aaa56a8..59f6315b 100644 --- a/pyrogram/types/user_and_chats/chat_invite_link.py +++ b/pyrogram/types/user_and_chats/chat_invite_link.py @@ -18,6 +18,7 @@ from datetime import datetime from typing import Dict +from typing import Optional import pyrogram from pyrogram import raw, utils @@ -103,7 +104,10 @@ class ChatInviteLink(Object): client: "pyrogram.Client", invite: "raw.base.ExportedChatInvite", users: Dict[int, "raw.types.User"] = None - ) -> "ChatInviteLink": + ) -> Optional["ChatInviteLink"]: + if not isinstance(invite, raw.types.ChatInviteExported): + return None + creator = ( types.User._parse(client, users[invite.admin_id]) if users is not None