From 740bcd145a215a1b1640844702b3d29f84c94268 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Sat, 31 Oct 2020 21:44:32 +0530 Subject: [PATCH] Update creator ChatMember with admin permissions (#523) --- pyrogram/types/user_and_chats/chat_member.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pyrogram/types/user_and_chats/chat_member.py b/pyrogram/types/user_and_chats/chat_member.py index 69ab4955..749e7065 100644 --- a/pyrogram/types/user_and_chats/chat_member.py +++ b/pyrogram/types/user_and_chats/chat_member.py @@ -217,6 +217,26 @@ class ChatMember(Object): status="creator", client=client ) + + if isinstance(member, raw.types.ChannelParticipantCreator): + permissions = member.admin_rights + return ChatMember( + user=user, + status="creator", + title=getattr(member, "rank", None), + joined_date=member.date, + invited_by=invited_by, + can_be_edited=member.can_edit, + can_change_info=permissions.change_info, + can_post_messages=permissions.post_messages, + can_edit_messages=permissions.edit_messages, + can_delete_messages=permissions.delete_messages, + can_restrict_members=permissions.ban_users, + can_invite_users=permissions.invite_users, + can_pin_messages=permissions.pin_messages, + can_promote_members=permissions.add_admins, + client=client + ) if isinstance(member, raw.types.ChatParticipantAdmin): return ChatMember(