Update creator ChatMember with admin permissions (#523)

This commit is contained in:
Shrimadhav U K 2020-10-31 21:44:32 +05:30 committed by GitHub
parent 61df1957a0
commit 740bcd145a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(