Update ChatInviteLink

This commit is contained in:
Dan 2021-12-22 14:13:44 +01:00
parent 7d917f43e5
commit 8f8c85e8f3

View File

@ -44,6 +44,12 @@ class ChatInviteLink(Object):
creator (:obj:`~pyrogram.types.User`, *optional*): creator (:obj:`~pyrogram.types.User`, *optional*):
Creator of the link. Creator of the link.
name (``str``, *optional*):
Invite link name
creates_join_request (``bool``, *optional*):
True, if users joining the chat via the link need to be approved by chat administrators.
expire_date (``int``, *optional*): expire_date (``int``, *optional*):
Point in time (Unix timestamp) when the link will expire or has been expired. Point in time (Unix timestamp) when the link will expire or has been expired.
@ -53,36 +59,45 @@ class ChatInviteLink(Object):
member_count (``int``, *optional*): member_count (``int``, *optional*):
Number of users that joined via this link and are currently member of the chat. Number of users that joined via this link and are currently member of the chat.
pending_join_request_count (``int``, *optional*):
Number of pending join requests created using this link
""" """
def __init__( def __init__(
self, *, self, *,
invite_link: str, invite_link: str,
creator: "types.User",
date: int, date: int,
is_primary: bool = None, is_primary: bool = None,
is_revoked: bool = None, is_revoked: bool = None,
creator: "types.User" = None,
name: str = None,
creates_join_request: bool = None,
start_date: int = None, start_date: int = None,
expire_date: int = None, expire_date: int = None,
member_limit: int = None, member_limit: int = None,
member_count: int = None member_count: int = None,
pending_join_request_count: int = None
): ):
super().__init__() super().__init__()
self.invite_link = invite_link self.invite_link = invite_link
self.creator = creator
self.date = date self.date = date
self.is_primary = is_primary self.is_primary = is_primary
self.is_revoked = is_revoked self.is_revoked = is_revoked
self.creator = creator
self.name = name
self.creates_join_request = creates_join_request
self.start_date = start_date self.start_date = start_date
self.expire_date = expire_date self.expire_date = expire_date
self.member_limit = member_limit self.member_limit = member_limit
self.member_count = member_count self.member_count = member_count
self.pending_join_request_count = pending_join_request_count
@staticmethod @staticmethod
def _parse( def _parse(
client: "pyrogram.Client", client: "pyrogram.Client",
invite: "raw.types.ChatInviteExported", invite: "raw.base.ExportedChatInvite",
users: Dict[int, "raw.types.User"] = None users: Dict[int, "raw.types.User"] = None
) -> "ChatInviteLink": ) -> "ChatInviteLink":
creator = ( creator = (
@ -93,11 +108,14 @@ class ChatInviteLink(Object):
return ChatInviteLink( return ChatInviteLink(
invite_link=invite.link, invite_link=invite.link,
creator=creator,
date=invite.date, date=invite.date,
is_primary=invite.permanent, is_primary=invite.permanent,
is_revoked=invite.revoked, is_revoked=invite.revoked,
creator=creator,
name=invite.title,
creates_join_request=invite.request_needed,
expire_date=invite.expire_date, expire_date=invite.expire_date,
member_limit=invite.usage_limit, member_limit=invite.usage_limit,
member_count=invite.usage member_count=invite.usage,
pending_join_request_count=invite.requested
) )