From 5f2dcf70edef2a3c3768a55a9cb5fc99d2157168 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 24 Apr 2022 11:56:07 +0200 Subject: [PATCH] Fix invited_by being optional --- pyrogram/types/user_and_chats/chat_member.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyrogram/types/user_and_chats/chat_member.py b/pyrogram/types/user_and_chats/chat_member.py index 9b585d7c..cff2ac43 100644 --- a/pyrogram/types/user_and_chats/chat_member.py +++ b/pyrogram/types/user_and_chats/chat_member.py @@ -151,7 +151,10 @@ class ChatMember(Object): user=types.User._parse(client, users[member.user_id]), joined_date=utils.timestamp_to_datetime(member.date), promoted_by=types.User._parse(client, users[member.promoted_by]), - invited_by=types.User._parse(client, users[member.inviter_id]), + invited_by=( + types.User._parse(client, users[member.inviter_id]) + if member.inviter_id else None + ), custom_title=member.rank, can_be_edited=member.can_edit, privileges=types.ChatPrivileges._parse(member.admin_rights),