
    YPi!                         d Z ddlZddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZmZmZ ddlmZmZ erdd	lmZ  G d
 de      Zy)zIThis module contains an object that represents an invite link for a chat.    N)TYPE_CHECKINGOptionalUnion)TelegramObject)User)de_json_optionalto_timedelta)extract_tzinfo_from_defaultsfrom_timestampget_timedelta_value)JSONDict
TimePeriod)Botc                       e Zd ZdZdZ	 	 	 	 	 	 ddddedededed	ed
ee	j                     dee   dee   dee   dee   dee   dee   f fdZedeeee	j"                  f      fd       Zeddeded   dd f fd       Z xZS )ChatInviteLinku  This object represents an invite link for a chat.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`invite_link`, :attr:`creator`, :attr:`creates_join_request`,
    :attr:`is_primary` and :attr:`is_revoked` are equal.

    .. versionadded:: 13.4
    .. versionchanged:: 20.0

       * The argument & attribute :attr:`creates_join_request` is now required to comply with the
         Bot API.
       * Comparing objects of this class now also takes :attr:`creates_join_request` into account.

    Args:
        invite_link (:obj:`str`): The invite link.
        creator (:class:`telegram.User`): Creator of the link.
        creates_join_request (:obj:`bool`): :obj:`True`, if users joining the chat via
            the link need to be approved by chat administrators.

            .. versionadded:: 13.8
        is_primary (:obj:`bool`): :obj:`True`, if the link is primary.
        is_revoked (:obj:`bool`): :obj:`True`, if the link is revoked.
        expire_date (:class:`datetime.datetime`, optional): Date when the link will expire or
            has been expired.

            .. versionchanged:: 20.3
                |datetime_localization|
        member_limit (:obj:`int`, optional): Maximum number of users that can be members of the
            chat simultaneously after joining the chat via this invite link;
            :tg-const:`telegram.constants.ChatInviteLinkLimit.MIN_MEMBER_LIMIT`-
            :tg-const:`telegram.constants.ChatInviteLinkLimit.MAX_MEMBER_LIMIT`.
        name (:obj:`str`, optional): Invite link name.
            0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters.

            .. versionadded:: 13.8
        pending_join_request_count (:obj:`int`, optional): Number of pending join requests
            created using this link.

            .. versionadded:: 13.8
        subscription_period (:obj:`int` | :class:`datetime.timedelta`, optional): The number of
            seconds the subscription will be active for before the next payment.

            .. versionadded:: 21.5

            .. versionchanged:: v22.2
                |time-period-input|
        subscription_price (:obj:`int`, optional): The amount of Telegram Stars a user must pay
            initially and after each subsequent subscription period to be a member of the chat
            using the link.

            .. versionadded:: 21.5

    Attributes:
        invite_link (:obj:`str`): The invite link. If the link was created by another chat
            administrator, then the second part of the link will be replaced with ``'…'``.
        creator (:class:`telegram.User`): Creator of the link.
        creates_join_request (:obj:`bool`): :obj:`True`, if users joining the chat via
            the link need to be approved by chat administrators.

            .. versionadded:: 13.8
        is_primary (:obj:`bool`): :obj:`True`, if the link is primary.
        is_revoked (:obj:`bool`): :obj:`True`, if the link is revoked.
        expire_date (:class:`datetime.datetime`): Optional. Date when the link will expire or
            has been expired.

            .. versionchanged:: 20.3
                |datetime_localization|
        member_limit (:obj:`int`): Optional. Maximum number of users that can be members
            of the chat simultaneously after joining the chat via this invite link;
            :tg-const:`telegram.constants.ChatInviteLinkLimit.MIN_MEMBER_LIMIT`-
            :tg-const:`telegram.constants.ChatInviteLinkLimit.MAX_MEMBER_LIMIT`.
        name (:obj:`str`): Optional. Invite link name.
            0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters.

            .. versionadded:: 13.8
        pending_join_request_count (:obj:`int`): Optional. Number of pending join requests
            created using this link.

            .. versionadded:: 13.8
        subscription_period (:obj:`int` | :class:`datetime.timedelta`): Optional. The number of
            seconds the subscription will be active for before the next payment.

            .. versionadded:: 21.5

            .. deprecated:: v22.2
                |time-period-int-deprecated|
        subscription_price (:obj:`int`): Optional. The amount of Telegram Stars a user must pay
            initially and after each subsequent subscription period to be a member of the chat
            using the link.

            .. versionadded:: 21.5

    )_subscription_periodcreates_join_requestcreatorexpire_dateinvite_link
is_primary
is_revokedmember_limitnamepending_join_request_countsubscription_priceN
api_kwargsr   r   r   r   r   r   r   r   r   subscription_periodr   r   c                   t         |   |       || _        || _        || _        || _        || _        || _        || _        || _	        |	t        |	      nd | _        t        |
      | _        || _        | j                  | j                  | j                  | j
                  | j                  f| _        | j!                          y )Nr   )super__init__r   r   r   r   r   r   r   r   intr   r	   r   r   	_id_attrs_freeze)selfr   r   r   r   r   r   r   r   r   r   r   r   	__class__s                N/root/twitch_bot/venv/lib/python3.12/site-packages/telegram/_chatinvitelink.pyr"   zChatInviteLink.__init__   s      	J/ +$*>! * * 4?+7#'	/I/UC*+[_ 	' >JJ]=^!1C %%LLOOOO
 	    returnc                 0    t        | j                  d      S )Nr   )	attribute)r   r   )r&   s    r(   r   z"ChatInviteLink.subscription_period   s    "4#<#<H]^^r)   databotr   c                     | j                  |      }t        |      }t        |j                  d      t        |      |d<   t        |j                  dd      |      |d<   t        |   ||      S )z,See :meth:`telegram.TelegramObject.de_json`.r   r   N)tzinfo)r-   r.   )_parse_datar
   r   getr   r   r!   de_json)clsr-   r.   
loc_tzinfor'   s       r(   r3   zChatInviteLink.de_json   sj     t$ 2#6
*488I+>cJY,TXXmT-JS]^]wDc22r)   )NNNNNN)N)__name__
__module____qualname____doc__	__slots__strr   boolr   dtmdatetimer#   r   r   r"   propertyr   	timedeltar   classmethodr3   __classcell__)r'   s   @r(   r   r   &   s-   \|I* /3&*"4848,0* *.** * #	*
 * * cll+* sm* sm* %-SM* &j1* %SM* X&*X _XeC4F.G%H _ _ 
38 
3(5/ 
3EU 
3 
3r)   r   )r9   r>   r=   typingr   r   r   telegram._telegramobjectr   telegram._userr   telegram._utils.argumentparsingr   r	   telegram._utils.datetimer
   r   r   telegram._utils.typesr   r   telegramr   r    r)   r(   <module>rK      s@   & P  1 1 3  J 
 7h3^ h3r)   